FindReplaceForm KeyDownEvent

SyntaxEditor for Windows Forms Forum

Posted 7 years ago by Ernesto Obregon
Version: 12.1.0300
Avatar

Looking to access the FindReplaceForm KeyDown Event.  Right now the form will perform a search when we press the "F" key, but I want to add "F3" to the list.  Right now I have tried adding an EventHandler to trap for this, but the event does not get handled.

In the below code, the handler for the FormClosing works, but the KeyDown handler does not.  My Private Sub keypress works as it is the main keypress event that handles all keypress events from my syntax editor(s).

 

Dim Options As New FindReplaceOptions()
SearchForm = New FindReplaceForm(sender, Options)
SearchForm.Owner = Me
AddHandler SearchForm.FormClosing, AddressOf findrelaceform_Closing
AddHandler SearchForm.KeyDown, AddressOf keypress


 

How can I access the FindReplaceForm KeyPress events?

 

thanks

ernie

Comments (3)

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

Hi Ernie,

Our FindReplaceForm is just a regular Form with some controls on it.  My guess is that the F3 is routing to the focused control in the Form, not to the Form itself.  You might need to add a handler for each focusable control on the Form instead.


Actipro Software Support

Posted 7 years ago by Ernesto Obregon
Avatar

My applications KeyPress event is not catching any key presses that take place when the FindReplaceForm has focus, but yet the "F" and "Enter" keys are handled automtically by the FindReplaceForm when it has focus, but I cannot seem to find out where these are handled or how to change them. I did manage to get my AddHandler to take effect by setting the "FindReplaceForm.KeyPreview = True" but this still does not allow me to catch the forms KeyDown event where the "F" and "Enter" keys are handled. There is also a nice little message that pops-up that states "The specified text was not found" when the search has reached the end of the document. I would also like to gain access to this message? thanks ernie

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

Hi Ernie,

We don't have any special processors for those keys.  The Find Next button has a label where the F in Find is an accelerator so pressing Alt+F will execute it.  And it is also the default button for the Form so Enter will execute it.  You can see the full source for the FindReplaceForm in our SdiEditor demo's folder.  We copied the full source there in case you want to customize the dialog.

You can see from that source how text is returned via string resources (in our 2012.1 version) like:

SR.GetString("FindReplaceForm_NotFound_Message")

 You can also customize the text with calls like this that are done on app startup:

SR.SetCustomString("FindReplaceForm_NotFound_Message", "newvalue")


Actipro Software Support

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

Add Comment

Please log in to a validated account to post comments.