Page 1 of 1

onCloseSolution

PostPosted: Sat Dec 29, 2012 1:35 pm
by gianni1334131930
Servoy 5.2.15 smartclient from development: when the user hit the X button on application window the onCloseSolution is executed before onHide of current form.
I feel this is not correct...shouldn't it be the reverse way?

I mean: the user has requested to close the solution...
A) First the current form should be closed then the solution should be closed.
or
B) The solution is closed without hiding the current form because everything is going to be closed.

Question1: could someone give me any hint on why the current sequence/order of execution should be correct (examples / toughts) ?
Question2: is it possible to recognize on the onHide event it was started because of closing solution request?

Happy 2013 to everyone!
Gianni

Re: onCloseSolution

PostPosted: Sun Dec 30, 2012 6:40 pm
by ROCLASI
Hi Gianni,

The current order of events makes a lot of sense. When you click the close button you are in fact closing the main window/solution so the onCloseSolution is triggered first. After the event is allowed to continue (you can control that) then it will close the open forms and those onHides will trigger. If you would reverse the event order you solution might get into some weird states when a close solution wasn't allowed to go through.

As for knowing if an onHide was triggered due to closing the solution I don't know of the JSEvent object holds this information when you close your solution.
I guess you could simply use a global variable that is being set to true when the onSolutionClose event is triggered. Then your code just have to check for this value.