[wx 2.5.3] How do I handle function keys F1..F12?

[wx 2.5.3] How do I handle function keys F1..F12?

Post by F. GEIGE » Wed, 01 Dec 2004 04:15:20


In my wx app a button bar is displayed at the bottom. It contains 12 buttons
named F1 thru F12. Now the user not only wants to be able to click on it but
also wants to be able to press the according keyboard key to make it have an
action. Yet, I don't know how to make those buttons work when the according
key on the keyboard is pressed.

The panel displayed is full of other widgets. Hopefully there's a chance to
bypass them all and to route F-keys directly to my button bar?

Any idea?

Many thanls in advance
Franz GEIGER
 
 
 

[wx 2.5.3] How do I handle function keys F1..F12?

Post by arjan.knep » Wed, 01 Dec 2004 15:41:45


Implement an eventhandler for wxKeyEvent using

EVT_CHAR ( Window :: OnChar )

void Window :: OnChar ( wxKeyEvent &e )
{
switch ( e.GetKeyCode () )
{
case WXK_F1 :
... // call button handler or generate buttonclick event and
post it.
case WXK_F2 :
...
case WXK_F3:
...
}
}



---------------------------------------------------------------------
To unsubscribe, e-mail: XXXX@XXXXX.COM
For additional commands, e-mail: XXXX@XXXXX.COM

 
 
 

[wx 2.5.3] How do I handle function keys F1..F12?

Post by F. GEIGE » Tue, 07 Dec 2004 02:05:20

Thank you Arjan,

but that doesn't work for me: Which widget should I bind this to?

For now I could get away with a timer in the main frame, that checks the
F-keys periodically after an wxActivateEvent.

Kind regards
Franz GEIGER

"Arjan Knepper" < XXXX@XXXXX.COM > schrieb im Newsbeitrag


buttons
but
an
according
to
 
 
 

[wx 2.5.3] How do I handle function keys F1..F12?

Post by j.trauntve » Thu, 09 Dec 2004 12:03:32

"F. GEIGER" < XXXX@XXXXX.COM > writes:



Use accelerators. Look up wxAccelerator in the help file.


Regards,

Jon Trauntvein


---------------------------------------------------------------------
To unsubscribe, e-mail: XXXX@XXXXX.COM
For additional commands, e-mail: XXXX@XXXXX.COM