Readonly document not working properly

SyntaxEditor for Windows Forms Forum

Posted 16 years ago by BLANC Stéphane - Staubli Robotics Suite Product Manager, STAUBLI
Version: 4.0.0276
Platform: .NET 3.5
Environment: Windows XP (32-bit)
Avatar
Hi,

it's possible to modify a readonly document using completion or the insert snippet method.

To reproduce it,
- Open the "SDI Editor Application"
- Set editor.Document.ReadOnly to true
- Launch the application.

It's not possible to edit the document BUT
if you display the word completion list or the code snippets list
(using the menu "Edit - Insert Code Snippet") and select an item
the document is modified...

Regards

Stéphane

Comments (4)

Posted 16 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
The way SyntaxEditor is designed is that user initiated actions should automatically be blocked in the case of a read-only document. However you are still able to programmatically do things like Document.ReplaceText, etc.

The same goes for member lists. You'll note that Ctrl+Space doesn't work when the document is read-only, however when you press a toolbar button to show a member list programmatically it does show. This is by design since there may be cases where you do want to allow a member list to show, even in a read-only document. For your scenario I would recommend you disable the appropriate toolbar buttons when the document is read-only so the programmatically-initiated UI doesn't show up.

Make sense?


Actipro Software Support

Posted 16 years ago by BLANC Stéphane - Staubli Robotics Suite Product Manager, STAUBLI
Avatar
I understand what you mean but it looks like the behaviour
of your "readonly property" is an EditorView.ReadOnly more than a Document.ReadOnly.

I agree with you that you may need to display a member list while the Document is marked as readonly, but in my opinion, you shouldn't be able to modify it as described in the documentation :
Document.ReadOnly Property = Controls whether text in the document can be changed.

Anyway, it was just a remark and I already blocked the action using the "UpdateState" property of commands.

Thanks for your answer

Stéphane

[Modified at 09/26/2008 04:34 AM]
Posted 16 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
That's true, it is more of a UI-related read-only property. By default methods like Document.ReplaceText won't pay attention to it (because most times you want to be able to programmatically alter the document even if it is read-only) however you can pass a flag value to them indicating to check for read-only state. All the UI-initiated routines pass that flag when calling those document modification methods, which is why they get blocked. So that is why Document has the ReadOnly flag.

The case of the member list is more of a gray area though since you may want to be able to show a member list for something, even in read-only mode. It would be odd if the toolbar button displayed the list but then nothing happened if the user chose something. It probably is best to just have your side check for the document being editable before displaying the list.


Actipro Software Support

Posted 16 years ago by BLANC Stéphane - Staubli Robotics Suite Product Manager, STAUBLI
Avatar
Finally I used the Selection.ReadOnly in order to update commands state
and it works fine for me (because sometime the user is in a "Single line edit" mode)

Thanks for your answers

Stéphane
The latest build of this product (v24.1.0) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.