Solution onClose event does not work in 202209.2

Forum to discuss the new web client version of Servoy.

Solution onClose event does not work in 202209.2

Postby tkilshaw1553613063 » Wed Dec 07, 2022 9:52 pm

I added a method call to my solution onClose event hook. My method was:
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
*
* @return {Boolean}
*
* @properties={typeid:24,uuid:"0F5045E5-F376-4910-A7BF-82366617CA01"}
*/
function onSolutionClose( force )
{
  application.output('onClose bForce: ' + force );
  return true;
}


First, how is a value for the "force" parameter passed? I do not call onSolutionClose directly. I thought it was supposed to be called automatically in response to the user clicking the browser or tab's close box. How then does the "force" parameter get its value?

Is what I am doing right? As far as I can see my method is never called.

I tried this on my solution and on my Login module with the same results.

We are using 202209.2 developer on Windows 10.

We are still working with the NG1 forms. We have not moved to Titanium.
tkilshaw1553613063
 
Posts: 47
Joined: Tue Mar 26, 2019 5:11 pm

Re: Solution onClose event does not work in 202209.2

Postby jcompagner » Wed Dec 07, 2022 10:40 pm

servoy will call that onclose method at the moment we close the client
the force boolean is when its not a user close (like calling application.exit()) but a system close when you can't stop the close anyway.

it will be called after 1 minute after a tab is closed, but in the developer this is a bit tricker to test. But it you kill the client through the admin page you should see it.
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8828
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Re: Solution onClose event does not work in 202209.2

Postby tkilshaw1553613063 » Wed Dec 07, 2022 10:58 pm

Thanks Johann.

We need to stop users closing the browser tab or window if they still have forms open other than the main tab set, so a 1 minute delay is not going to work.

Any ideas about how we can do that?

Terry
tkilshaw1553613063
 
Posts: 47
Joined: Tue Mar 26, 2019 5:11 pm

Re: Solution onClose event does not work in 202209.2

Postby jcompagner » Thu Dec 08, 2022 11:21 am

pressing X doesn't directly mean close solution for us. that is just normal flow and that just lets the session timeout (thats 1 minute by default) and then we clean up the client.

our ngclientutils plugin do have: setOnUnloadConfirmation(boolean) that you can use to let the user know about that they are about to leave a page which they shouldnt

you can toggle that on an off with that boolean.
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8828
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Re: Solution onClose event does not work in 202209.2

Postby tkilshaw1553613063 » Thu Dec 08, 2022 6:42 pm

So is this called once after the user logs in or is it somehow associated with one or more forms?

thanks,

Terry
tkilshaw1553613063
 
Posts: 47
Joined: Tue Mar 26, 2019 5:11 pm

Re: Solution onClose event does not work in 202209.2

Postby jcompagner » Thu Dec 08, 2022 6:49 pm

what do you mean?

you need to call it when you don't want users to close your tab (or at least try to avoid that they do that)

Servoy doesn't do that, so i don't know what you mean with associated with one or more forms.
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8828
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Re: Solution onClose event does not work in 202209.2

Postby tkilshaw1553613063 » Thu Dec 08, 2022 8:03 pm

I figured it out Johan. Thanks for your help.
tkilshaw1553613063
 
Posts: 47
Joined: Tue Mar 26, 2019 5:11 pm


Return to Servoy NGClient

Who is online

Users browsing this forum: No registered users and 6 guests