keypress handling

G

Guest

I need to implement keypress handler that works anywhere on a form (actually so long as I am on one of several tab pages on my form which is basically a tab control with 4 pages. Here is the problem - my TabControl.Keypress handler intercepts the keypress only of one of the grids on that same tab does not have focus. Essentially, once I select a row on a grid, my handler no longer receives keypresses, as they are now aparently directed to the selected grid. The handler is invoked if I am editing one of the edit controls. How can I intercept ALL keypresses within the form/tab page? Do I have to resort to the windows message handler?
 
H

Herfried K. Wagner [MVP]

* "=?Utf-8?B?Z2Fycmljaw==?= said:
I need to implement keypress handler that works anywhere on a form
(actually so long as I am on one of several tab pages on my form which
is basically a tab control with 4 pages. Here is the problem - my
TabControl.Keypress handler intercepts the keypress only of one of the
grids on that same tab does not have focus. Essentially, once I select a
row on a grid, my handler no longer receives keypresses, as they are now
aparently directed to the selected grid. The handler is invoked if I am
editing one of the edit controls. How can I intercept ALL keypresses
within the form/tab page? Do I have to resort to the windows message
handler?

Did you set the form's 'KeyPreview' property to 'True'?
 
C

ClayB [Syncfusion]

Have you tried setting the Form's KeyPreview property to true?

====================
Clay Burch, .NET MVP

Visit www.syncfusion.com for the coolest tools

garrick said:
I need to implement keypress handler that works anywhere on a form
(actually so long as I am on one of several tab pages on my form which is
basically a tab control with 4 pages. Here is the problem - my
TabControl.Keypress handler intercepts the keypress only of one of the grids
on that same tab does not have focus. Essentially, once I select a row on a
grid, my handler no longer receives keypresses, as they are now aparently
directed to the selected grid. The handler is invoked if I am editing one of
the edit controls. How can I intercept ALL keypresses within the form/tab
page? Do I have to resort to the windows message handler?
 

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