When performing a lengthy operation (e.g. looping through a selection of records) you may want to display a thermometer or another type of progress indicator. This makes for more patient users.
The principle for this is simple: the thermometer is located on a separate form and its variable name is an interprocess variable. The calling process (the one that is actually performing the task) will create a new process that uses that form and will periodically update the thermometer via the interprocess variable.
The code running in the calling process could be as follows:
$proc:=New process("Launch_Thermo";32*1024)
For ($i;1;5000)
&Mac215;Thermo:=($i/5000)*100
CALL PROCESS(-1)
CREATE RECORD([Table 1])
[Table 1]Field1:=String($i)
SAVE RECORD([Table 1])
End for
CALL PROCESS($proc)
The process created will use the Launch_Thermo method which consists of the following (where form1 is the thermometer's form):
$Winref:=Open form window([Dialog];"Form1")
DIALOG([Dialog];"Form1")
From there, the only missing code is the code responsible for closing the thermometer window. You will surely notice the call to the thermometer process (CALL PROCESS($proc)). When combined with the following code in the form method of form 1, the outside call will close the thermometer window.
Case of
: (Form event=On Outside Call )
If (&Mac215;thermo=100)
CANCEL
End if
End case