Is it possible to prevent text replacements from the find form

SyntaxEditor for Windows Forms Forum

Posted 9 years ago by James Sconfitto - Exele Information Systems, Inc.
Version: 14.1.0322
Avatar

I have an editor that is set to read only, but i can still perform replacements. I'd like to be able to prevent replacements from happening. I'm thinking that I can watch for text replacements programmatically, but I'd much rather just disable the replace button in the find form.

What is the best method for me to prevent text replacement in an editor with text set to read only?

Comments (2)

Posted 9 years ago by James Sconfitto - Exele Information Systems, Inc.
Avatar

I'm attempting to do this by hooking into the Document.TextChanging event and using the following code:

' Cancel all text replacements when the file is read only
Dim isReplacement As Boolean = e.Modification.Name.Contains("Replace") OrElse e.IsProgrammaticTextReplacement
e.Cancel = IsReadOnly AndAlso isReplacement

 Not sure if that's the best code, but my e.Cancel property ends up True after executing that code yet my file still has its text replaced from the find form. Is there something I'm doing wrong or misunderstanding here?

Posted 9 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi James,

Thanks for letting us know about this.  The FindReplaceForm should really be doing checks for read-only documents here.  We've updated our code for the next maintenance release to add those checks and disable the replace buttons and their functionality if the document is read-only.

If you want to write our support address and reference this thread, we can send you the updated FindReplaceForm to use and that should fix your problem without you needing to do anything else.


Actipro Software Support

The latest build of this product (v24.1.0) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.