I was looking for a way to bypass a specific piece of code in my onClose method which is hooked up to my solutions ‘onClose’ event.
Having a closer look on default arguments (passed by Servoy) I ran into the ‘force’ argument which is passed to the method at the ‘onClose’ event.
I’ve tested with the code below, but either which way I close my application, the ‘force’ arguments keeps returning false.
Anyone any idea when this arguments will be true?
/**
* Callback method for when solution is closed, force boolean argument tells if this is a force (not stopable) close or not.
*
* @param {Boolean} force if false then solution close can be stopped by returning false
*
* @returns {Boolean} allow close
*
* @properties={typeid:24,uuid:"9AA3BE5A-F1D0-4CE0-889A-1AF4D307FCAE"}
*/
function onSolutionClose(force)
{
var $title = 'close';
var $message = 'force? ' + force;
var $button = 'ok';
plugins.dialogs.showInfoDialog($title, $message, $button);
}
It would be really nice if this could be set to true when ‘application.exit()’ could take this as an argument as well.
This way you can have better control over the force argument I guess…
If the Client is closed from the Admin pages it will return true
Paul
Thnkx Paul,
could have thought of that myself ![Smile :)]()
-
Would it be nice to have the ‘force’ option being triggered by an argument which can be added to application.exit() ??
-
Speaking of closing from the admin pages: often we need to request twice to have the client disconnected (mostly client that are idle for quite a while)
- Would it be nice to have the ‘force’ option being triggered by an argument which can be added to application.exit() ??
You can already have a global var and read that in your onHide method and do something based on that. But, you could also register this as a feature request
- Speaking of closing from the admin pages: often we need to request twice to have the client disconnected (mostly client that are idle for quite a while)
Registered this as case already?
Paul
pbakker:
You can already have a global var and read that in your onHide method and do something based on that. But, you could also register this as a feature request
I guess I’ll do both, I need it ‘yesterday’, but would be nice for the future ![Smile :)]()
pbakker:
Registered this as case already?
I have to do some testing on this. Something crossed my mind and it could be my code is the cause of this… ![Confused :?]()
If not I’ll file a case and post the casenr. here
Thnkx so far!
the double request we had to do on force closing of the client was caused by our code. ![Embarassed :oops:]()
The code tried to show a confirmation dialog, which is not supported when you force close the client from the admin pages.
I bypassed the dialog when the ‘force’ argument is true and a single request is all I need ![Very Happy :D]()
Excellent tip, tnx for posting back!
mboegem:
the double request we had to do on force closing of the client was caused by our code. ![Embarassed :oops:]()
The code tried to show a confirmation dialog, which is not supported when you force close the client from the admin pages.
I bypassed the dialog when the ‘force’ argument is true and a single request is all I need ![Very Happy :D]()
that is a bug already fixed for 6
i will ask to backport this fix to 5.1
But showing a dialog that the user can say no to doesnt make much sense yes when it is forced…
jcompagner:
that is a bug already fixed for 6
i will ask to backport this fix to 5.1
Sure, very welcome!
jcompagner:
But showing a dialog that the user can say no to doesnt make much sense yes when it is forced…
That’s true, but closing a client from the admin pages when the client wants to show a dialog as defined in the onClose method results in an error.
Error is something like ‘dialog not supported in a non swing environment’.
This is where the duplicate close request was needed, the first request pops up this error, the second request just overrules this error…
I needed the code to bypass anyway, as I needed to introduce and test a global var ‘forceClose’ as well.
When we call application.exit(), this is in fact a ‘force close’ from our solution, which may not be canceled by a users dialog…
Made a feat. request for this: #279427
Thnkx for your response Johan!
mboegem:
That’s true, but closing a client from the admin pages when the client wants to show a dialog as defined in the onClose method results in an error.
Error is something like ‘dialog not supported in a non swing environment’.
Hi Marc,
This errormessage has been fixed already (case #273829) and will be available in the next release
Martin
jcompagner:
that is a bug already fixed for 6
i will ask to backport this fix to 5.1
Version 6 already. You guys are going much too fast … ![Smile :)]()