Lock or Disable the Windows Closebox

Clicking in the closebox of the window of a Solution of Servoy will not only close the solution but also shut down the programm. I would like to avoid both.
With starting a transaction you should be able to avoid undesired canceling of a script. Clicking the closebox will show a dialog which asks for commiting the running transaction: clicking Yes will save changes, but clicking No will also save changes, in every case servoy will be shut down.
Is there a way to catch all attempts of closing a window and handling this?

(In filemaker with the comand: Allow User Abort it is possible to prohibit closing a Window at runtime.)

Servoy release 1.2 rc6 supports solution onOpen/onClose properties in the preferences, onClose will always be called before the window closes.

Thank you for this advise!
We’ve found the new menu-item called solution-settings in tools for choosing a startUp and closing method out of the existing global methods. In the closing-script we can rollback transaction or even ask for committing transaction by dialog.
But is there a way to stop the unwished closing of the solution in the closing method also?
Is there any command which could stop closing when the closing method is executed in a before phase or would disabeling the closebox of the window be the solution?

Also see http://forum.servoy.com/viewtopic.php?t=619

yes, it would be nice, that you can prevent users from closing the app.

something like this:

dialogResult = plugins.dialogs.showDialog('Alert','Do you want to Quit?','Yes','Cancel');	
if ( dialogResult == "Yes" )
{
	application.exit
}	
else
{
	return; //do not quit!
}

This is not working now!

I know I have seen this working in somebody’s solution (asking a user if he wants to close or not)… Does anybody know how to do this?
Thanks!
Patrick

I think it’s attaching an onclose method to your solution (solution Settings)

If you let the method return a “false”, then the solution is not closed.

Paul

That is what I am trying :wink:, but it closes anyway…

just tested this. with a simple solution close method (return globals.close == 1) in that method.

Works fine. I can’t close the solution or servoy when the globals.close is not 1.

hmm, what I tried is the code above:

dialogResult = plugins.dialogs.showDialog(‘Alert’,‘Do you want to Quit?’,‘Yes’,‘Cancel’);
if ( dialogResult == “Yes” )
{
application.exit
}
else
{
return; //do not quit!
}

That doesn’t seem to work.

as also specified above. you have to return true or false!

so don’t do return; but return false;

Got it! Thank you!