• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Question Create Dynamic Event For A Fill-in

Cringer

ProgressTalk.com Moderator
Staff member
#2
You can't dynamically add a trigger to a widget, but if you want to fire the trigger already on the widget then
apply "leave" to MyHandle.
That should do it. Or something similar - not got the exact syntax to hand.
 
#3
You have any idea for this problem ?
See my problem :

I have one frame with many fill-ins, and one disable fill-in, but this fill-in have a on-leave event.
This on-leave event put values in other fill-ins after then.

I need that one other fill-in call this on leave event.
 

Cringer

ProgressTalk.com Moderator
Staff member
#4
I have given you the solution. You say you have a handle. Apply "leave" to the handle. But the widget has to be active for the trigger to fire if I remember correctly, so enable the widget, apply leave, disable the widget.
 

Osborne

Active Member
#5
As Cringer says, you need to apply "leave". In this basic example, when you leave one widget it also applies leave to another widget:
Code:
ON LEAVE OF FILL-IN-1 IN FRAME FRAME1
DO:
   APPLY "LEAVE" TO FILL-IN-2.
END.

ON LEAVE OF FILL-IN-2 IN FRAME FRAME1
DO:
   MESSAGE "LEAVE has been applied to this widget" VIEW-AS ALERT-BOX.
END.
 

Osborne

Active Member
#6
Another option that may be helpful is setting the leave trigger to run an internal procedure, and in the internal procedure you set the other widgets:
Code:
DEFINE VARIABLE hWidget AS HANDLE NO-UNDO.

hWidget = FILL-IN-1:HANDLE IN FRAME FRAME1.
ON LEAVE OF hWidget PERSISTENT RUN xxx IN THIS-PROCEDURE.
 
#7
I don't have source of the window where are this fill ins.
The window have a call for external program (i have source of this program), so i have only handles of components.
This is a patern from Totvs ( enterprise that makes ERP system in brazil ).

This external program is call when the window open, so when window open i need change the on leave of fill in 1 for call the fill in 2 leave.

I dont know if this is possible.
 

Osborne

Active Member
#8
I am not sure if this will work as never tried it, but one possible solution is walk-the-widget tree of the window - Progress KB - How to walk the widget tree.

If you can obtain the handle of the window using one of the below, then read all the frames and widgets and for the relevant fill-ins set to run a procedure as per post #6.
Code:
h_widget = CURRENT-WINDOW.
hWin = SESSION:FIRST-CHILD.
 
#9
This external program is call when the window open, so when window open i need change the on leave of fill in 1 for call the fill in 2 leave.
How the external program is called - persistently or not?
If external program is called persistently then look at fi-proc.p.
If external program is not called persistently then you must run persistent procedure to handle leave event. See how to do that (once) in fi-proc.p and use fi-persproc.p as template.
fi-proc.p and fi-persproc.p must be placed in folder named "temp" in the working directory.
Use fi-win.w to see both cases demo.
 

Attachments

Last edited: