Consultor Eletrônico



Kbase P23190: How to create session triggers which will fire in the entire progress session ?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   8/10/2009
Status: Verified

GOAL:

How to create session triggers which will fire in the entire progress session ?

GOAL:

What is the scope of a session trigger?

FACT(s) (Environment):

All Supported Operating Systems
Progress 7.x
Progress 8.x
Progress 9.x
OpenEdge 10.x
OpenEdge Category: Language (4GL/ABL)

FIX:

A session trigger is defined within a Progress procedure. The trigger persists while the procedure that defined it and any subprocedures are running. A session trigger takes effect when Progress encounters it at run time. It remains in effect until the defining procedure terminates or is overridden by a new session trigger definition for the same event. The following code demonstrates some session trigger definitions for various events. These triggers will fire in the entire progress session : /* MyStartup.p */

on 'CTRL-F8':U anywhere persistent run StartWord.w.
on 'ALT-F8':U anywhere persistent run StartExcel.w.
on 'CTRL-F9':U anywhere persistent run MyCompiler.w.
on 'ALT-F9':U anywhere persistent run spy.w.
on 'CTRL-F12':U anywhere run MyProcess.p.


ON ? ANYWHERE
DO:
IF SELF:TYPE = 'FILL-IN' AND
SELF:DATA-TYPE = 'character' AND
SELF:CURSOR-OFFSET = 1 THEN DO:

ASSIGN SELF:SCREEN-VALUE = "?" + SELF:SCREEN-VALUE
SELF:CURSOR-OFFSET = 2.
RETURN NO-APPLY.

END.
END.

ON ANY-PRINTABLE ANYWHERE
DO:
IF SELF:TYPE = 'FILL-IN' AND
SELF:DATA-TYPE = 'character' AND
SELF:SCREEN-VALUE = '?' THEN DO:

ASSIGN SELF:SCREEN-VALUE = "?" + KEYLABEL(LAST-KEY).
SELF:CURSOR-OFFSET = 3.
RETURN NO-APPLY.
END.
END.


RUN _ab.p. /* Start AppBuilder */

/* end procedure */