Problem using CALL FORM with a DIALOG

Hi everyone.

Right now I’m working in a form for display a progress bar and some messages from the process where it’s called, the problem is when i want to update info inside that window using CALL FORM and i displayed the form using DIALOG.

if i use CALL FORM before DIALOG, the form is updated, but if i use it after DIALOG, nothing changes, this is my code

<code 4D>
$window_:=Open form window(“PRG_Progreso”;Palette form window;Horizontally centered;Vertically centered)
SET WINDOW TITLE(“Espere…”;$window_)
CALL FORM($window_;“PRG_Configurar”;$1;$2;$3;$4)

</code 4D>

and of course, i need to update info on that form using subsequent calls from the main method, but i can’t make it works

some help is really appreciated

windowRef becomes invalid the moment you use DIALOG with an *

CLOSE WINDOW(…), for example, throws an error.

In the form that’s being opened with Dialog(…;*), you could update a process object that keeps track of the windows being opened that way.

Case of
: (Form event=On Load)
OB SET(processObj.openWin;""+String(Current form window);Current form window)
: (Form event=On Unload)
OB REMOVE(processObj.openWin;"
"+String(Current form window))
End case

In the code above the windows are kept with the window number being part of the property name, but the property name could be more useful:

OB SET(processObj.openWin;“MyCalc”;Current form window)

CALL FORM(processObj.openWin.MyCalc;“PRG_Configurar”;$1;$2;$3;$4))

: Keisuke MIYAKO

windowRef becomes invalid the moment you use DIALOG with an *

CLOSE WINDOW(…), for example, throws an error.

The doc mention that we can use it that way :

You can combine the use of the DIALOG(form;*) syntax with the CALL
FORM command to establish communication between the forms.

There is also an example at FORM>

Am I missing something?


it depends on how CALL FORM is used, I suppose.

here is a working example of DIALOG(*) + CALL FORM.

I can not comment on the original post.
but it seems like CALL FORM is used in the wrong context (outside of event cycle).

hello Keisuke…
maybe it does not work with “close window”, but references ARE still valid!

Example: in the code below, I keep 4 refernces for dialog I opened with dialog (*)

<code 4D>
Case of
: ($work.task=“init”)
win1:=Open form window(“D_Rect”;Plain form window;On the left;At the top)
win2:=Open form window(“D_Rect”;Plain form window;On the right;At the top)
win3:=Open form window(“D_Rect”;Plain form window;On the left;At the bottom)
win4:=Open form window(“D_Rect”;Plain form window;On the right;At the bottom)

</code 4D>

Run “WorkerSteps” method in the sample database

Hope this helps

Roland :slight_smile:

just a few minutes difference!

so then,

do you think you can answer the question asked in the original post?

Hello Jorge

There are many ways to manage a progress or any worker and window.

I suggest you have a look on the example i posted in this thread.

The way “I” work is

#1) Create a worker

This worker will either open the window(s), call it (them), then close it (them).
this can be done with a parameter (“init”, “call”, “close” for instance.

#2) Let the worker call the form(s)
-> sent a parameter “call” to the worker who “knows” the references of the windows it has opened during the “init” (keep the references in process variables (not local)

#3) call the worker to “kill” itself (do not kill it from outside, let it finish it’s tasks)
(when called to kill itself, the worker should call the forms to “cancel” the dialogs)

Again the sample I posted should help !

Hope this helps !


Hi, thanks everybody for your replies, i’ve seen that when i execute this method, the system waits until the method finishes to change information in the window, so i think that there isn’t asychronous in that context.

In that case, i guess i need to work with CALL WORKER as in the example of ronald, i’ll try to change my code and the way that it works with other processes.

If i have another question i’ll ask you again guys

Thanks a lot for your help