Question Create Dynamic Event For A Fill-in

fdantas

New Member
Hi friends,

I have a handle of Fill-in, how i do for create a on leave event in this fill in ? This is possible ?
 

Cringer

ProgressTalk.com Moderator
Staff member
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.
 

fdantas

New Member
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
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
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
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.
 

fdantas

New Member
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
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.
 

nborshukov

New Member
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

  • fi-win.w
    9.5 KB · Views: 12
  • fi-proc.p
    3.6 KB · Views: 12
  • fi-persproc.p
    3.1 KB · Views: 9
Last edited:
Top