Gracefully closing a panel

Posted By: Zheka

Gracefully closing a panel - 07/17/19 15:02

JCL,

If I launch a script for Testing/Trading and then [Stop] it and/or close Zorro, the panel continues to be visible on the screen without the possibility to close it (no closing/ 'cross' button in the upper right corner).
I then have to kill that Zorro instance via Task manager.

I tried this in the click():
Code
  if (row == -1 && is(RUNNING))  panel(0, 0, 0, 0);

Then pressing [Result] while the script awaits a click on my START button in the panel (while (!START && is (RUNNING)) wait(100); )- works and makes the panel disappear.

However, if I then close Zorro altogether, an instance of Zorro still runs and still has to be killed via Task manager.

Why would this happen?
Posted By: jcl

Re: Gracefully closing a panel - 07/17/19 15:59

I got this forwarded from support today, but your info is so sparse that I too could not make anything out of it.

An application that not terminates is usually hanging in an endless loop. Look for this in your script. Systematically comment out parts of code until it does not hang anymore. If you then still have no success in fixing it, contact Support - they'll help.
Posted By: Zheka

Re: Gracefully closing a panel - 07/17/19 16:35

I assumed that pressing a [Stop] button in Zorro terminates the running script, unloads user dll (probably except for a function like click()..) .and so the script cannot "hang" after that.


How is it in reality?
Posted By: Spirit

Re: Gracefully closing a panel - 07/17/19 21:25

https://en.wikipedia.org/wiki/Infinite_loop
Posted By: Zheka

Re: Gracefully closing a panel - 07/17/19 23:18

Code
while ( is(RUNNING))  wait(100);
within main() does not terminate when a [Stop] button is pressed (probably because RUNNING works in run() ).

Is there another way?


Posted By: AndrewAMD

Re: Gracefully closing a panel - 07/17/19 23:50

while (wait(100))

wait returns 0 when stop is pressed. You can make use of that info to call quit() and then return.
Posted By: Zheka

Re: Gracefully closing a panel - 07/18/19 00:02

Great, this works! Thank you very much!
© 2024 lite-C Forums