Consultor Eletrônico



Kbase P76441: How to handle UI events that apply to multiple widgets in Dynamics environment
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   14/04/2004
Status: Unverified

GOAL:

How to handle UI events that apply to multiple widgets in Dynamics environment

FACT(s) (Environment):

Dynamics 2.1A

FIX:

It is sometimes required to define one or more UI events that can occur
on multiple widgets in an object type. One example of such a behavior
is definition of an UI event trigger procedure that needs to be fired
when the certain event occurs on every widget in an object such as viewer.
Defining the UI event for each widget in the master object can be time
consuming, especially if the same behavior is required for all object
masters of the same class type.

One example would be where pressing the arrow-up key (CURSOR-UP) on every
widget needs to cause shifting of the focus to the previous widget in the
tab order of the viewer's frame. In the case of the static viewer this
can be achieved with the following trigger definition:


ON 'CURSOR-UP':U OF {&FRAME-NAME} ANYWHERE:
DO:
  APPLY 'BACK-TAB':U TO SELF.
  RETURN NO-APPLY.
END.


If this behavior is required for the specific master object, then it
is necessary to put the code into its own super procedure.
However, in order to enforce the same behavior for the entire class,
it is necessary to add appropriate code in the custom super procedure
of the class itself (for example in viewercustom.p).

The steps required to achieve this are:
1) In the viewer's super procedure override of the 'initializeObject'
obtain the viewer's frame handle and then define the trigger for it:


RUN SUPER.

ON 'CURSOR-UP':U OF hViewerFrame ANYWHERE PERSISTENT
RUN handleCursorUp IN TARGET-PROCEDURE.

Here the 'hViewerFrame' variable contains the handle of the viewer's frame
and 'handleCursorUp' is the name of the trigger procedure.

2) In the same super procedure create the 'handleCursorUp' internal procedure
with the following code:


APPLY 'BACK-TAB':U TO SELF.
RETURN NO-APPLY.


This will enforce the same behavior for all widgets in a viewer for the
'CURSOR-UP' event.