Consultor Eletrônico



Kbase 18281: ACTIVEX. How To Get Accelerators For Normal Widgets Working
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   02/11/2004
Status: Unverified

GOAL:

How to Get Accelerators for Normal Widgets Working

FIX:

When using ActiveX Controls (OCX) in a Progress window, any accelerator keys defined for normal Progress widgets will not work when the ActiveX Control has the focus.  This is because the ActiveX Control gets all of the keystrokes before Progress ever sees them.

In order to get the accelerator keys to work you must put code behind some keyboard handling event that the ActiveX Control exposes.

Typically the event will have a name like one of the following:


KeyPress
KeyUp
KeyDown

Since there is no real standard for defining the keyboard interface for ActiveX Controls (although most controls use the above names), you will need to determine which event is most appropriate for your use.

As an example, if I have a button on a window named BUTTON-1 (which uses "Alt+T" as its accelerator key) and an instance of Microsoft's Masked Edit control the following code attached to the "KeyUp" event which  the Masked Edit control exposes will trigger the CHOOSE event of BUTTON-1:


DEFINE INPUT PARAMETER p-KeyCode AS INTEGER NO-UNDO.
DEFINE INPUT PARAMETER p-Shift   AS INTEGER NO-UNDO.

IF p-KeyCode = 18 AND p-Shift = 4 THEN  /* Alt+T Pressed */
APPLY "CHOOSE":U TO BUTTON-1 IN FRAME {&FRAME-NAME}.


FIX:

References to Written Documentation:

Progress Solutions:

21284, "ACTIVEX - How To Send Accelerators To Normal Widgets"