[Gambas-user] Closing signals

Leonardo Miliani leonardo at ...1237...
Thu Feb 8 12:06:34 CET 2007


timothy wrote:
>> -----Original Message-----
>> From: gambas-user-bounces at lists.sourceforge.net [mailto:gambas-user-
>> bounces at lists.sourceforge.net] On Behalf Of Leonardo Miliani
>> Sent: Wednesday, 07 February 2007 10:45 PM
>> To: mailing list for gambas users
>> Subject: [Gambas-user] Closing signals
>>
>> Hello everybody.
>> I would like to know if there's a way to intercept what is trying to
>> close a Gambas application.
>> I remember that in VB there was a way to read the closing signal to
> know
>> if the application had been closed from the user by clicking on the
> "X"
>> icon or if the system was shutting down and was sending all the
>> applications the terminating signal.
>>
>> I would like to write a check in my applications to close them in a
> safe
>> way if they intercept a terminating signal from the system, i.e.
> during
>> shutdowns or reboots, to avoyd data loosing.
>> Thanks.
>>
>> --
>> Ciao.
>> Leo.
>>
> 
> 
> Hi,
> 
> Not sure if this is what you are getting at. But STOP EVENT will stop a
> form closing if it is used in a Form's Close event. So if all you need
> is to handle the user clicking the X on a window then this will do the
> job.
> 
> Suppose we have a variable to tell us if changes to our have not been
> saved:
> 
> PRIVATE dataChanged AS Boolean
> 
> We then set this if the user changes something. And also clear it if the
> user saves. Then we can put this in our Form close event.
> 
> PRIVATE dataChanged AS Boolean
> 
> PUBLIC SUB Form_Close()
>   DIM result AS Integer
>   dataChanged = TRUE
>   IF dataChanged THEN 
>     result = Message.Question("Are you sure?", "Quit without saving",
>          "Save then quit", "Cancel")
>     IF result = 2 THEN
>       ' If save is selected then save before quitting
>       PRINT "Do save here"
>     ELSE IF result = 3 THEN 
>       ' If cancel is pressed then cancel close form event
>       STOP EVENT 
>     END IF
>   END IF  
> END
> 
> 
> Thanks
> 
> 8-{)} Timothy Marshal-Nichols
> <mailto: timothy.marshal-nichols at ...247...>
> 
> 
> 
> 
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier.
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
> 
> 

That's not my case.
I know about STOP EVENT and use it to stop the user when he tries to
close the program before saving datas.
But, if the user terminates the working session closing KDE and he
forgets my program opened, this one is brutally closed by the system and
 the user looses its datas.

I would like to know if in Gambas there's a method or a register that
collects the system messages, so when the user closes KDE and my program
is still running, it collects the system shutdown and automatically
saves all the data avoiding data loosing.

-- 
Ciao.
Leo.

Web: www.leonardomiliani.com
E-mail: leonardo at ...1237...
Scegli software opensource - Choose opensource software




More information about the User mailing list