Basic4ppc - Windows Mobile Development  

Go Back   Basic4ppc - Windows Mobile Development > Main Category > Questions & Help Needed
Home Register FAQ Members List Search Today's Posts Mark Forums Read

Questions & Help Needed Post any question regarding Basic4ppc.


How to Catch the [X]


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-21-2007, 04:43 PM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 1,343
Awards Showcase
Forum Contributer 
Total Awards: 1
Default How to Catch the [X]

Hi,

I think I saw a post about this in the old forum, how can we catch the [X] press event?

I know this sounds stupid....heres my code..

Quote:
Sub Exxit_Click 'exxit is a workaround for the exit menuitem
If inplay=true then
x = Msgbox ("Do you really wish to Exit?", "Exit Pairs v2.0", cMsgboxYesNo, cMsgboxQuestion)
If x=cyes then
AppClose
else
return
end if
else
AppClose
End if
End Sub

Sub Main_Close
Exxit_click
End Sub
What happens is that it seems to be a circular call(!?), What i'm trying to acomplish is that wether thru the "exit" menu item, wether thru the [X] button, the user is questioned if the "inplay" var is true.
What am I doing wrong?
__________________
Paulo Gomes
Porto, Portugal

PC: Dual-Core 1,8Ghz, 2GB RAM, 80GB HD
PPC: Qtek9000, 1GB SD

DLL Version Listing

Last edited by Cableguy : 05-21-2007 at 04:52 PM.
Reply With Quote
  #2 (permalink)  
Old 05-21-2007, 05:19 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 3,186
Default

AppClose closes the main form.
This is the right code:
Code:
Sub Exxit_Click 'exxit is a workaround for the exit menuitem
 AppClose
End Sub

Sub Main_Close
  If inplay=true then
 if msgbox("Do you really wish to Exit?", "Exit Pairs v2.0", cMsgboxYesNo, cMsgboxQuestion) = cNo then
  Main.CancelClose
End If
End If
End Sub
Reply With Quote
  #3 (permalink)  
Old 05-21-2007, 05:21 PM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 1,343
Awards Showcase
Forum Contributer 
Total Awards: 1
Default

I understand your code, but where is the error in my code, my logic is only in the wrong way, but still true isn't it?
As I understand Applose calls the form_close event/sub? and if not present it close the form...Wright?
__________________
Paulo Gomes
Porto, Portugal

PC: Dual-Core 1,8Ghz, 2GB RAM, 80GB HD
PPC: Qtek9000, 1GB SD

DLL Version Listing

Last edited by Cableguy : 05-21-2007 at 05:23 PM.
Reply With Quote
  #4 (permalink)  
Old 05-21-2007, 05:24 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 3,186
Default

Calling AppClose calls Main_Close which calls again AppClose... until you get a stack overflow.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
How To Catch The "ENTER" button? ceaser Questions & Help Needed 2 10-21-2008 05:58 PM
How to catch cursor hardkeys on Windows? Vito Questions & Help Needed 1 02-06-2008 05:44 PM
How catch a selected treeview item information by mouse ? dan kabestan Questions & Help Needed 2 01-08-2008 07:30 PM
Catch hardkeys in textbox control ? conf Questions & Help Needed 2 06-15-2007 11:28 PM
How to catch hardkeys ? conf Questions & Help Needed 5 06-04-2007 06:05 PM


All times are GMT. The time now is 04:05 PM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0