Kbase 12817: ENABLE vs. VIEW and Keyboard events
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  10/05/1998 |
|
ENABLE vs. VIEW and Keyboard events
Unexpected behavior may be seen with keyboard event triggers if you
use a VIEW statement as opposed to an ENABLE. The following code,
which uses a SYSTEM-HELP trigger meant to fire when the CURSOR-DOWN
event occurs, shows the difference.
/* cursor.p */
DEF BUTTON b_test.
ON cursor-down OF current-window
DO:
MESSAGE "in here".
SYSTEM-HELP "editing.hlp" CONTENTS.
END.
FORM b_test WITH FRAME f_g.
ENABLE b_test WITH FRAME f_g. /* comment out this line and
replace it with:
VIEW FRAME f_g.
so the trigger fires */
MESSAGE "Press cursor-down for help".
WAIT-FOR window-close OF current-window.
When the ENABLE statement is used, the frame and button are active,
so the keyboard events are sent to the button and are not
propagated to the window. The trigger, attached to the window,
will not fire. Using a VIEW statement instead, does not cause the
widgets in the window to be enabled, so keyboard events are sent
to the window and the trigger fires. However, the frame and button
are not active.
The correct method is to use the ENABLE statement in conjunction
with an ANYWHERE on the trigger as below. Using ANYWHERE
propagates the event up the widget hierarchy, so the trigger fires.
ON cursor-down ANYWHERE DO:
...
END.
Progress Software Technical Support Note # 12817