We use a small dialog form to add a simple record, which resides in a floating windows form (smart client).
We use the dialog framework for that task which works very well:
We need to make that dialog form totally modal, and took already the windows header away, so that the user could not close the form with the X on right upper side.
Now we have just one issue left we could not solve:
The user is still able to close that window with the Escape button.
Is there a way to prevent this?
I guess this is a generic question for all windows forms, not only for this dialog framework from Servoy Forge:
How to disable the escape button for forms in windows…
you can prevent closing any dialog by returning ‘false’ in the onHide function of the form which you are showing in the dialog.
So I suggest you set a formVariable with a value at the onShow of the form, ie. allowHide = false;
When the user is pressing the buttons you want him to press, you can set the allowHide variable to true.
In the onHide function you’ll need to return allowHide.
function onHide(event) {
//just any code you want to do at onHide
return allowHide;
}
You could also have a look at the svyCustomDialogs scope on github (https://github.com/Servoy/svyUtils/wiki/Custom-Dialogs). It can replace the mod_dialog feature wise and allows you to easily build any kind of simple dialog with any number of components in it (like a simple change password dialog). And a CustomDialog has an onClose property that gives you control over the “X”.