Consultor Eletrônico



Kbase 15106: Example - LAST-EVENT handle with WIDGET-ENTER & WIDGET-LEAVE
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   10/05/1998
Example - LAST-EVENT handle with WIDGET-ENTER & WIDGET-LEAVE


The LAST-EVENT handle can be used to determine the widget you just
left when going to another widget, or can be used to tell which
widget you're about to go to when leaving a widget. By accessing
this information you can process triggers differently or cancel their
processing altogether.

It is important to note that the WIDGET-ENTER and WIDGET-LEAVE
attributes of the LAST-EVENT handle are valid *only* when used within
ENTRY and LEAVE triggers. If used on other triggers, say, on CHOOSE
of a button, these attributes will not have meaningful values.

An example of WIDGET-LEAVE. If the user is in Fill-in-4 and selects
the Quit button, this is detected by the trigger.


DEF VAR wh AS WIDGET-HANDLE NO-UNDO.

ON ENTRY OF Btn_Quit IN FRAME myframe DO:

wh = LAST-EVENT:WIDGET-LEAVE.
IF wh:LABEL = "Fill 4" THEN MESSAGE "You left fill-in-4".

END.


An example of WIDGET-ENTER. If the user leaves Fill-in-4 by choosing
the Quit button, the LEAVE is cancelled and the Quit button's CHOOSE
event does not fire.


DEF VAR wh AS WIDGET-HANDLE NO-UNDO.

ON LEAVE OF Fill-in-4 IN FRAME myframe DO:

wh = LAST-EVENT:WIDGET-ENTER.
IF wh:LABEL = "Quit" THEN DO:

MESSAGE "You chose the Quit button".
RETURN NO-APPLY. /* Don't allow the LEAVE event */
END.
END.

Progress Software Technical Support Note # 15106