Questions and answers on designing your Servoy solutions, database modelling and other 'how do I do this' that don't fit in any of the other categories
by t-rob » Tue Mar 08, 2016 10:30 pm
I have code that confirms the user wants to exit the Smart Client when they click a Logout button. Is there a way to create a user confirmation when they simply click the "X" (in Windows) to close the main window of the application? Or maybe there is a way to disable the "X"?
-
t-rob
-
- Posts: 9
- Joined: Tue Oct 27, 2009 5:51 pm
by mboegem » Tue Mar 08, 2016 11:20 pm
Just attach the function below to the 'onClose' event handler.
You'll find this event in the properties off the (main) solution.
- Code: Select all
/**
* Callback method for when solution is closed, force boolean argument tells if this is a force (not stoppable) close or not.
*
* @param {Boolean} force if false then solution close can be stopped by returning false
*
* @returns {Boolean}
*/
function onSolutionClose(force) {
var _sAnswer = 'OK';
if(!force) {
_sAnswer = plugins.dialogs.showQuestionDialog('Exit application','Are you sure you want to exit the application?', 'Cancel', 'OK');
}
return (_sAnswer == 'OK')
}
-
mboegem
-
- Posts: 1749
- Joined: Sun Oct 14, 2007 1:34 pm
- Location: Amsterdam
-
by t-rob » Wed Mar 09, 2016 5:39 am
Perfect! Works great. Thank you!!
-
t-rob
-
- Posts: 9
- Joined: Tue Oct 27, 2009 5:51 pm
Return to Programming with Servoy
Who is online
Users browsing this forum: Google [Bot] and 10 guests