application.onExit()?

Discuss all feature requests you have for a new Servoy versions here. Make sure to be clear about what you want, provide an example and indicate how important the feature is for you

application.onExit()?

Postby krauss » Fri Dec 03, 2004 9:04 pm

Here's one for the list...

It would be very nice to have an application.onExit() method that one could call to perform end-of-session housekeeping duties such as last-minute error-checking, orphan record clenaup, etc.
All generalizations are false.
krauss
 
Posts: 17
Joined: Wed Mar 24, 2004 6:52 pm

Postby pbakker » Sat Dec 04, 2004 12:47 pm

Under Solution settings you allready have an osulitionclose method.

Paul
pbakker
 
Posts: 2822
Joined: Wed Oct 01, 2003 8:12 pm
Location: Amsterdam, the Netherlands

Postby krauss » Sun Dec 05, 2004 8:33 pm

I'm aware of the onSolutionClose(), but what I'm worried about is users who don't shut down cleanly.

What would be ideal is a method that captures the clicking of the main window close box in the same way that, for example, onDelete events can be captured from a form.



_________________________

"User Error: Replace User and Restart."
krauss
 
Posts: 17
Joined: Wed Mar 24, 2004 6:52 pm

Postby patrick » Sun Dec 05, 2004 8:46 pm

The method that you attach in solution settings as "on close method" does exactly what you want: capture the clicking of the main window close box (and other ways of exiting the solution, of course).

If you attach a method onSolutionClose you can prevent the user from exiting, asking him for example if he really wants to shutdown the app. Just do something like

Code: Select all
var button = plugins.dialogs.showQuestionDialog( '',  'Really quit?',  'Yes', 'No');
if (button == 'No')
{
   return false;
}


The only thing you cannot do (I believe) is distinguish between various ways of exiting the solution (close box/Menu/Method)...

Patrick
patrick
 
Posts: 3703
Joined: Wed Jun 11, 2003 10:33 am
Location: Munich, Germany

Postby krauss » Sun Dec 05, 2004 9:46 pm

Thanks, Patrick! That is exactly what I was looking for.

I was unable to find this in the documentation; if it's not that my eyes (and brain) are going bad, perhaps this detail could be added?
All generalizations are false.
krauss
 
Posts: 17
Joined: Wed Mar 24, 2004 6:52 pm

Postby mnorman » Sun Dec 05, 2004 10:32 pm

krauss wrote:Thanks, Patrick! That is exactly what I was looking for.

I was unable to find this in the documentation; if it's not that my eyes (and brain) are going bad, perhaps this detail could be added?


Krauss,

The information you are looking for can be found in the Servoy Developer
Edition Volume 1: User's Guide, Chapter 17, "Settings", in section
17.2 "Solution settings", subsection 17.2.4 "Choosing a method to close
your solution", page 549.

If you do not yet have the printed documentation, you can also use the
online Servoy Help Navigator:
-Choose Help>Help (F1).
-Select the "Search" tab.
-Enter "onClose", "solution", or "setting" in the search box.
-Double click on the "Solution settings" topic in the Topic List.

Once the topic is open, you can go directly to the area you are interested in:
-Choose Tools>Find.
-Enter one or more characters in the "Find What" box.
-Press "Find Next" to highlight the first instance of your search criteria.
-Press "Find Next" for each addtional instance of your search criteria.

NOTE: Make sure that you have a topic open BEFORE you choose Tools>Find.

_____________
Marc Norman
Servoy
mnorman
 
Posts: 106
Joined: Wed Sep 24, 2003 8:50 pm
Location: Alturas, CA

Postby krauss » Mon Dec 06, 2004 6:58 pm

Not to quibble, but the information I was looking for isn't actually in the documentation. The section to which you refer (and which I'd already looked at when I made my first post on the topic) is composed of a screen shot and the following text:

Choosing a method to close your solution
You can run a Servoy method (script) just before your solution closes. The On close method setting is blank or "<none>" by default when a new solution is created.
To select an on close method:
*Choose File > Solution Settings.
* Select the method you want to run from the On close method pull-down list (or select <none>).


That's it.

It doesn't say that the on close method captures the event when someone clicks on the main close box. That's the condition I'm concerned about, and that's what I'm suggesting be added to the documentation.
All generalizations are false.
krauss
 
Posts: 17
Joined: Wed Mar 24, 2004 6:52 pm

Postby mnorman » Mon Dec 06, 2004 7:39 pm

krauss wrote:Not to quibble, but the information I was looking for isn't actually in the documentation. The section to which you refer (and which I'd already looked at when I made my first post on the topic) is composed of a screen shot and the following text:

Choosing a method to close your solution
You can run a Servoy method (script) just before your solution closes. The On close method setting is blank or "<none>" by default when a new solution is created.
To select an on close method:
*Choose File > Solution Settings.
* Select the method you want to run from the On close method pull-down list (or select <none>).


That's it.

It doesn't say that the on close method captures the event when someone clicks on the main close box. That's the condition I'm concerned about, and that's what I'm suggesting be added to the documentation.


Krauss,

We appreciate your detailed input and will modify the description of the
onClose method solution setting in the documentation to include this option.

_____________
Marc Norman
Servoy
mnorman
 
Posts: 106
Joined: Wed Sep 24, 2003 8:50 pm
Location: Alturas, CA

Postby martinh » Mon Sep 10, 2007 11:30 am

The Solution setting onClose method is a good workaround, but I think the application.onExit() is still useful.

I have an application that has several modules. Already about 12 modules, but this will be more in the near future.
Now I have to put in all these solutions a call to a method that I want to run when the application closes (I need to check if the database is in a transaction and if it is, I'll do a rollback)

I would be easier if I could run this script from an application.onExit to avoid that some of the submodules doesn't have the onClose method filled.
Martin
------------------------------------------------
Servoy Developer
Version 5.2.10/5.2.13
Java version 1.6 update 31
Database SQL Server 2008 R2
martinh
 
Posts: 857
Joined: Wed May 09, 2007 5:34 pm
Location: Belgium


Return to Discuss Feature Requests

Who is online

Users browsing this forum: No registered users and 9 guests

cron