handling f3 on the form

G

Guest

Hello,

I have a form and when the user presses the F3 key I want to set the focus
to a textbox where the user can enter a search query.

I figured this had to be really straightforward, but it turns out it isn't.

I tried putting an eventhandler KeyDown on the form, but it never gets
called for the F3 key.
Also tried KeyUp, KeyPress, ProcessDialogKey, ProcessDialogChar,
ProcessDialogCmd, PreProcessMessage. Nothing worked.
I also tried it with KeyPreview set to true on the form.

Strange thing is, that Shift-F3 works, but F3 doesn't.

Now I don't know what to do else.

Any ideas?

Best regards,
Ike Casteleyn
 
G

Guest

Hello,

Since everything works fine on an empty form, I did some more investigation.

My toolbar was blocking the F3 key from happening.

Best regards,
Ike
 
H

Herfried K. Wagner [MVP]

ike said:
I have a form and when the user presses the F3 key I want to set the focus
to a textbox where the user can enter a search query.

Add a main menu component, add an item with F3 as shortcut assigned and
place the code in the menu item's 'Click' event handler. The shortcut will
even work if the menu item is not visible.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top