FindReplaceForm.Options ignores changes

SyntaxEditor for Windows Forms Forum

Posted 11 years ago by Douglas Peterson
Version: 4.0.0271
Avatar
I have a FindReplaceForm that I keep around and use Show() when the user presses a key. The first time this occurs, the form is created with some default options.

I am trying to change the options on the existing instance of the form to no avail.

There are two things I want to change before calling Show():

1) If there is any selected text, set SearchInSelection = true
2) If there is a word under the cursor, set FindText to that word
findReplaceOptions.SearchInSelection = codeEditor.SelectedView.Selection.Length > 0;
string caretWord = codeEditor.Document.GetWordText(codeEditor.Caret.Offset);
if (!String.IsNullOrEmpty(caretWord))
   findReplaceOptions.FindText = caretWord;
I've tried using:
findReplacementForm.Option.X = value

I've tried retaining a reference to the original FindReplaceOptions instance I created when I created the FindReplaceForm and setting those.

It seems to ignore any changes made after the FindReplaceForm has been created.

Comments (4)

Posted 11 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Douglas,

Can you put together a small sample project that shows this happening and email it over so we can debug it? This all should work ok if it is configured properly. Thanks!


Actipro Software Support

Posted 11 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Thanks for the sample, it won't update the Form from the options unless you reset the Options property. So in your sample do this right before you call Show():
findReplaceForm.Options = findReplaceOptions;
This would probably even work:
findReplaceForm.Options = findReplaceForm.Options;


Actipro Software Support

Posted 11 years ago by Douglas Peterson
Avatar
Thank you, that works.

I must point out that it is not very intuitive, to me at least. Is this a common pattern? I've not encountered it before.

[Modified at 02/12/2008 12:16 PM]
Posted 11 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Sorry I forgot to mention that I added an OnVisibleChanged override on the Form that will also update the UI from the options. This change will be in the next maintenance release so the workaround I mentioned won't be needed after that.


Actipro Software Support

The latest build of this product (v2018.1 build 0341) was released 6 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.