Consultor Eletrônico



Kbase 15315: What is a Developer Event and why might I need one (SAMPLE)
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   5/10/1998
What is a Developer Event and why might I need one (SAMPLE)

This notebook entry discusses Developer Events which are
available with Version 7 and later releases of PROGRESS.
The first portion outlines Developer Events and describes
how they are implemented. The second provides an example
of an application which requires a Developer Event.

Event-driven applications make use of event triggers to
determine when certain portions of the application should
be executed. These events are categorized as Keyboard
events, Mouse events, High Level Widget events, Direct
Manipulation events, or Developer events. Developer
events are distinct from the other types in that they
are completely "soft" events -- there is no connection
between any hardware event necessary. In other words,
the event can be triggered by the application itself.

Developer events are given the labels "U1" through
"U10". To cause a Developer event to fire, the 4GL
programmer would insert the statement
APPLY "U1" TO <object>
at the point where the processing should occur.
Elsewhere in the procedure, the associated trigger
would be defined:
ON U1 OF <object> DO:
<processing to be done>.
END.

Example:
The following example is uses Version 8 SmartObjects.
There is a SmartPanel based on the p-updsav.w navigation
panel, and a SmartViewer. When the navigation panel is
instantiated, the logic behind the Add button will be
executed without the user having to actually click on the
Add button.

To do this, copy the master SmartObject p-updsav.w to
myupdsav.w somewhere in the PROPATH. Open myupdsav.w
from the UIB. At the top of the Main Block, add the
following code:
ON U1 ANYWHERE DO:
APPLY "CHOOSE":U TO btn-add.
END.
Create a SmartViewer for the table to be maintained.
Modify the SmartViewer to trigger the U1 event:
ON ENTRY OF
<the name of the SmartViewer frame or DEFAULT-FRAME> DO:
APPLY "U1":U TO h_myupdsav.
END.
This will essentially "press" the Add button in the
SmartPanel each time the SmartViewer is realized.

Note that h_myupdsav refers to the handle of the
navigation panel. This handle is automatically generated
in the UIB and is always in the form of h_<program>.

Because the SmartViewer cannot be compiled with any
reference to widgets in other SmartObjects, a
statement like APPLY "CHOOSE":U TO btn-add would fail
to compile.

REFERENCES TO OTHER DOCUMENTATION:
PROGRESS Language Reference Appendix C "Events"


Progress Software Technical Support Note # 15315