Overloading a define trigger

erick.rosales

New Member
OK I have this strange and dark idea....

There is a Compiled Program which is a Window with widgets... All is fine till here.

It has a button called btn-save. Since this is a Compiled Program I don´t have the source code to add more tasks to do in the trigger ON-CHOOSE.

The only thing that I've gotten is catch the Widget in a Widget-handle variable... (Maybe this would bu unuseful, but I have it...)

The question is:

There is any way to OVERLOAD a TRIGGER?

The idea is, when the Statements in the triggers finish... My code start to execute.

Well... There is for the great world of Progress Developers..-

Thanks¡¡¡¡
 

FrancoisL

Member
Nice thinking outside the box there . Wish i could tell you that what you are trying to do is possible but unless i am mistaken it not possible.

You cannot overload or add multiple calls to one Event like in .Net . You can Overwrite the trigger by declaring a new one but i am afraid that in your case you need the code inside the original trigger. If you know the code inside the original trigger then you can put that and your code in a new trigger and overwrite the old one.
 

erick.rosales

New Member
Yes Francois... You are right... Only I wanted to confirm that this is not posible in Progress.

But thinking... (The necesity is the mother of the creativity)....

I'm going to use a DATABASE TRIGGER in order to do the Procedure to store in other Tables ... Well at least it has a solution....

Thanks Francois...
 

bulklodd

Member
theoretically you can do that especially if you've got a handle of the button.

here's the snippet which shows how it can be done:

Code:
/* test.p contains the 'choose' trigger we wanna overload and
** returns the handle of the widget with the trigger in question */
DEFINE OUTPUT PARAMETER bhandle AS HANDLE     NO-UNDO.
DEF BUTTON b1 LABEL "xxx".
DEFINE FRAME f.
FORM b1 WITH FRAME f.
ON CHOOSE OF b1 
DO:
   MESSAGE "pressed"
      VIEW-AS ALERT-BOX INFO BUTTONS OK.
END.
ENABLE ALL WITH FRAME f.
bhandle = b1:HANDLE.

Code:
/* procedure overloads the trigger of test.p  */
DEFINE VARIABLE bhandle AS HANDLE     NO-UNDO.
RUN test.p PERSISTENT (OUTPUT bhandle).
DEFINE VARIABLE fhandle AS HANDLE     NO-UNDO.
fhandle = bhandle:FRAME.
ON LEFT-MOUSE-CLICK OF bhandle 
DO:
   MESSAGE "choose"
      VIEW-AS ALERT-BOX INFO BUTTONS OK.
   APPLY "choose" TO bhandle.
END.

WAIT-FOR GO,END-ERROR OF fhandle.
fhandle:VISIBLE = NO.

of course there are some issues with the code but if in general the code can be applied to your case all issues can be sorted out.

hth
 

FrancoisL

Member
Good idea but you have to be careful to cover every way to trigger a button beside left-click to make sure a user doesn't bypass the code that you want to add.
 
Top