onCloseSolution

Questions, tips and tricks and techniques for scripting in Servoy

onCloseSolution

Postby gianni1334131930 » Sat Dec 29, 2012 1:35 pm

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
gianni1334131930
 
Posts: 3
Joined: Wed Apr 11, 2012 10:12 am

Re: onCloseSolution

Postby ROCLASI » Sun Dec 30, 2012 6:40 pm

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.
Robert Ivens
SAN Developer / Servoy Valued Professional / Servoy Certified Developer

ROCLASI Software Solutions / JBS Group, Partner
Mastodon: @roclasi
--
ServoyForge - Building Open Source Software.
PostgreSQL - The world's most advanced open source database.
User avatar
ROCLASI
Servoy Expert
 
Posts: 5438
Joined: Thu Oct 02, 2003 9:49 am
Location: Netherlands/Belgium


Return to Methods

Who is online

Users browsing this forum: No registered users and 12 guests