Consultor Eletrônico



Kbase P39768: How to disable a Session TRIGGER?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   29/08/2003
Status: Unverified

GOAL:

How to disable a Session TRIGGER?

CHANGE:

If you are trying to disable a Session Trigger this Solution is an example of how to achieve this.

FIX:

There is no Progress 4GL command that will disable Session Triggers.
However it is possible to achieve this programatically by using a logical field.

Lets say that you have a Session Trigger in a Fill-in named FILL-IN-1 and an associated trigger for ANY-PRINTABLE.

i.e.

ON ANY-PRINTABLE OF FILL-IN-1 DO:
MESSAGE KEYFUNCTION(LASTKEY).
END.

And depending on other events you want to make fire this Session Trigger or not.

One of the way to achieve this is to use modal programming for the Session Trigger.

In the previous example the Session Trigger will always fire, Now the trigger will fire depending on a previous event.

Define a logical field in the Local Variables Definition Section i.e.

DEF VAR LLOGICAL AS LOGICAL NO-UNDO INITIAL TRUE.

Now modify the ANY-PRINTABLE Trigger for FILL-IN-1.

ON ANY-PRINTABLE OF FILL-IN-1 DO:
IF LLOGICAL = TRUE THEN
MESSAGE KEYFUNCTION(LASTKEY).
END.

Lets say that the LLOGICAL variable is set by a button. The Trigger for the Button will be:

ON CHOOSE OF BUTTON-1 DO:
IF LLOGICAL = TRUE THEN LLOGICAL = FALSE.
ELSE IF LLOGICAL = FALSE THEN LLOGICAL = TRUE.
END.

This will enable or disable the Trigger depending on if the Button has been pressed or not.