comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: howto bind shortcut key to button
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: howto bind shortcut key to button [message #34213 is a reply to message #34082] Thu, 20 February 2003 08:05 Go to previous message
JD Smith is currently offline  JD Smith
Messages: 850
Registered: December 1999
Senior Member
On Wed, 19 Feb 2003 07:24:53 -0700, David Fanning wrote:

> Sebastian (s@visita2.die.upm.es) writes:
>
>> is there a way to bind a shortcut key to a button? I would like to do
>> something like pressing CTRL+S while my app is in hte foreground evokes
>> myapp->save.
>> I didn't find anything useful on this in the manual and the ng archive,
>> and the idl demo doesn't seem to use keyboard short-cuts.
>
> Under Microsoft Windows, including the ampersand character (&) in the
> value of a button widget causes the window manager to place an underline
> under the character following the ampersand. This is a feature of
> Microsoft Windows, and is generally used to indicate which character is
> used as a keyboard accelerator for the button. If you plan to run the
> application on *anything* other than Windows, though, forget it. The
> ampersand will show up on the button and there will be no accelerating
> effect. This is a WINDOWS ONLY feature. :-(
>

Two other options:

1. My old hidden WIDGET_TEXT hack (see
http://dfanning.com/widget_tips/keyboard_events.html). May work
with modifier keys and arrow keys (if you use an even wierder hack
-- search the NG for "key events"). Not terribly platform
independent.

2. A hidden WIDGET_DRAW (or actual widget_draw if your application
uses it) with KEYBOARD_EVENTS set. Only available starting with
IDL v5.6. Works well with modifier keys and arrow/PageUp|Down
keys. Should be platform independent.

The problem with both of these solutions: you need to give the
appropriate widget text focus. With #2, it will occur automatically
when you interact with the draw widget. I personally would have liked
KEYBOARD_EVENTS to be WIDGET_BASE, which would be delivered events if
no other element had text focus. The workaround I use: set
TRACKING_EVENTS on the top-level widget base, and explicitly give the
appropriate widget focus when entering the application.

Good luck,

JD
[Message index]
 
Read Message
Read Message
Previous Topic: Re: counting bits
Next Topic: Is there a way to use C++ code in IDL

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Mon Dec 01 18:08:17 PST 2025

Total time taken to generate the page: 0.88414 seconds