![]() |
|
|||||||
| Home | Register | FAQ | Members List | Search | Today's Posts | Mark Forums Read |
| Questions & Help Needed Post any question regarding Basic4ppc. |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Hello,
i've got a question regarding the close/ok button every device app does have in the upper right corner. My App has two ways to exit out of it.One is through a button and the other one is by use of the menu.I do some cleanup before i really terminate the application. This looks like this: Code:
Sub Button3_Click ' Quit Button ExitApp End Sub ... Sub Menu5_Click ' Menu Quit ExitApp End Sub ... Sub ExitApp ... do some clean up ... AppClose End Sub If the user pushes the close/ok button, the app just terminates without doing any of my cleanup tasks. To have the cleanup also done in this case, i just added the following: Code:
Sub Form1_Close ExitApp End Sub - can someone explain, why these exceptions occur..? I ran through the code, but i cannot explain this behavior, even then if i take into account that my form is ( probably ) already closed by the OS..? -Is there a chance to just catch the close/ok button event without having the OS close the form..? cheers TWELVE |
|
|||
|
Hi twelve,
Is it maybe the application was just minimized or just hide in backround when when closing the form? ie. when using the formlib.dll library. form1.New1("form1",B4PObject(1)) '1st form library to enable minimize button form1.MinimizeBox=True 'X' or 'OK' press just hide in background make form1.MinimizeBox=false to disable.
__________________
Rioven Sony Ericsson XPERIA X1i WM6.1 480x800 Display Resolution with QWERTY keyboard Last edited by Rioven : 06-03-2008 at 03:36 PM. Reason: added last line |
|
||||
|
AppClose closes the main form and therefore launches Sub Form1_Close which then calls AppClose again.
The simplest solution is to move your cleanup code into Sub Form1_Close. You can use Form.CancelClose to cancel the closing process. |
|
|||
|
Quote:
Quote:
How is the syntax then, do you have an example piece of code..? The Basic4PPC help is very poor, often i do not understand how a certain instruction or parameter does work, sometimes i don't even understand what the instruction does. @Rioven: no i do not use the fullscreen stuff from the formlib, yet. kind regards TWELVE |
|
|||
|
Hi TWELVE,
This works for me. Code:
Sub Form1_Close
If Msgbox("quit application?","",cMsgboxYesNo,cMsgboxQuestion)=cyes Then
DoSomeCleanUp
AppClose
Else
form1.CancelClose
End If
End Sub
Quote:
__________________
Rioven Sony Ericsson XPERIA X1i WM6.1 480x800 Display Resolution with QWERTY keyboard |
|
|||
|
I have full screen on my ppc App. But I get a double take with Msgbox.
I have to accepet Yes or No twice to get it to work. Code:
Sub ImageButtonExitForm1_Click
Msgbox ("Do you want to quit?",, cMsgBoxYesNo)
Form1.Close
End Sub
Sub Form1_Close
If Msgbox ("Do you want to quit?",, cMsgBoxYesNo) = cNo Then
Form1.CancelClose
End If
End Sub
Last edited by cdeane : 06-06-2008 at 07:57 PM. |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| minimize or close? | Byak@ | Questions & Help Needed | 3 | 09-28-2008 05:18 PM |
| Improved Close Event | RandomCoder | Basic4ppc Wishlist | 5 | 09-26-2008 07:00 PM |
| HIDE TITLE BAR ? hide title, minimize , max and Close button (FOR DESSKTOP EXE) | pegamaster | Questions & Help Needed | 0 | 07-04-2008 03:59 PM |
| close button | kavka | Questions & Help Needed | 4 | 02-27-2008 10:29 AM |
| SQLite Open Close - how often? | sloopa | Questions & Help Needed | 3 | 05-01-2007 03:01 PM |