1. RE: Hot/Accelerator Keys

Hi "jjnick at cvn.com",

> Okay, I give up, how does one implement Hot/Accelerator keys?
>  I searched
> the mailing list to no avail.  Apparently it must be an easy
> excercise  . .
> .?  I know about using the "&" symbol to precede a letter in
> the control
> definitions, but how do I access this in code?  Please tell
> me I don't have
> to use the onKeyDown event!

what are you trying to do with hot keys?

When you say "how do I access this in code?", what is the "this" you are
referring to? Are you asking how to know which are the hot keys associated
with a given control? Or are you wanting to know which hot key is pressed?
Or are you trying the get your code to react to a hotkey press?

To associate a hot key with a specific control use ...

    registerHotKey(id, keycode)

eg.
    -- Make the Alt-F9 key "press" the button.
    registerHotKey( btnClose, VK_F9)

To get a list of hot keys and the associated controls, use ...

    sequence rdata
    -- Get the list of controls for this parent window that have hots keys,
    -- and a list of the hotkey keycodes.
    rdata = getControlInfo( myWin, {CONTROLINFO_hotkey_ids,
                                    CONTROLINFO_hotkey_keys})

    for i = 1 to length(rdata[1]) do
          -- Control rdata[1][i] has hotkey rdata[2][i]
    end for

A hotkey sets the focus to the control that owns the hotkey, thus causing a
GotFocus event. If that control is a button, it also causes the Click event
to happen. Thus normally one codes a handler for GotFocus or Click to trap
hotkey presses. But it doesn't distinguish between a hotkey and a normal
invocation.

Do you need to know if either of these two events were caused by a hotkey
rather than the normal triggering event, such as a TAB key or MouseClick or
SpaceBar for buttons? If so, you'd have to use the KeyDown event to catch
that.

-----------
cheers,
Derek Parnell

new topic     » topic index » view message » categorize

2. RE: Hot/Accelerator Keys

Hi,
If you are using the Hot Keys for buttons & menus by useing the & key then
nothing alse is required. I use this feature my self, the users simply holds
down the ALT key then presses the Hot Key.

Hope this helps

Tony Steward

-----Original Message-----
From: jjnick at cvn.com [mailto:jjnick at cvn.com]
Subject: Hot/Accelerator Keys




Okay, I give up, how does one implement Hot/Accelerator keys?  I searched
the mailing list to no avail.  Apparently it must be an easy excercise  . .
.?  I know about using the "&" symbol to precede a letter in the control
definitions, but how do I access this in code?  Please tell me I don't have
to use the onKeyDown event!

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu