Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Breaking out of a loop when window is closed

Author
Message
Briere
19
Years of Service
User Offline
Joined: 28th Feb 2005
Location: Amherst New York, United States
Posted: 4th Aug 2005 18:42
How can I make my program break out of the loop when the user presses the X?

Formerly The Fixxer
http://www.xiemsoft.cjb.net
OSX Using Happy Dude
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 4th Aug 2005 20:36
Sub-class the window, and in the sub-classed messaging loop, put in code at either WM_CLOSE or WM_DESTROY

AtomZ - its got an A. Its got a Z. Now its just needs U
Blog:http://spaces.msn.com/members/BouncyBrick/
Web Site:http://www.nicholaskingsley.co.uk
MiR
21
Years of Service
User Offline
Joined: 13th Jul 2003
Location: Spain
Posted: 4th Aug 2005 20:36
I might be missing something here but doesn`t LoopSDK () enable that? That`s why you have to have it in the loop. Or at least I thought so.


Gimme teh votez!!!!
OSX Using Happy Dude
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 4th Aug 2005 20:38
Most probably, but I dont think Xiemsoft wants to do it the easy way

AtomZ - its got an A. Its got a Z. Now its just needs U
Blog:http://spaces.msn.com/members/BouncyBrick/
Web Site:http://www.nicholaskingsley.co.uk
Briere
19
Years of Service
User Offline
Joined: 28th Feb 2005
Location: Amherst New York, United States
Posted: 4th Aug 2005 20:56
I didnt know that :-P

Formerly The Fixxer
http://www.xiemsoft.cjb.net
Briere
19
Years of Service
User Offline
Joined: 28th Feb 2005
Location: Amherst New York, United States
Posted: 4th Aug 2005 21:00 Edited at: 4th Aug 2005 21:01
Hum here is the code:



errors



Formerly The Fixxer
http://www.xiemsoft.cjb.net
MiR
21
Years of Service
User Offline
Joined: 13th Jul 2003
Location: Spain
Posted: 4th Aug 2005 23:14 Edited at: 4th Aug 2005 23:18

Should work. Of cause if GameLobby contains the loop then it won`t. In which case you might need to change things a bit. LoopSDK needs to be in the main loop. It isn`t a loop itself.


Gimme teh votez!!!!
Briere
19
Years of Service
User Offline
Joined: 28th Feb 2005
Location: Amherst New York, United States
Posted: 5th Aug 2005 18:39
Nope, it just froze my computer when I tried closing it both with the X and escape.

Formerly The Fixxer
http://www.xiemsoft.cjb.net
MiR
21
Years of Service
User Offline
Joined: 13th Jul 2003
Location: Spain
Posted: 5th Aug 2005 21:37
Strange. Is the main loop in GameLobby();? Just guessing as you haven`t got dbSync in main.


Gimme teh votez!!!!
Briere
19
Years of Service
User Offline
Joined: 28th Feb 2005
Location: Amherst New York, United States
Posted: 6th Aug 2005 04:03
I thought the main loop is

while((LoopSDK)){

}

Formerly The Fixxer
http://www.xiemsoft.cjb.net
OSX Using Happy Dude
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 6th Aug 2005 10:10
No, thats totally incorrect - LoopSDK is a function, not a variable...

AtomZ - its got an A. Its got a Z. Now its just needs U
Blog:http://spaces.msn.com/members/BouncyBrick/
Web Site:http://www.nicholaskingsley.co.uk
Troll Fiddler
19
Years of Service
User Offline
Joined: 19th Jan 2005
Location: Mayo, Ireland
Posted: 7th Aug 2005 16:18 Edited at: 7th Aug 2005 16:21
This works for me (talking about loopsdk not window closing)

while (LoopSDK()){

if (dbEscapeKey()){
break;
}

etc blah blah yak yak

}


<edit>Seems to have lost the formatting, but you get the drift</edit>
Briere
19
Years of Service
User Offline
Joined: 28th Feb 2005
Location: Amherst New York, United States
Posted: 15th Aug 2005 19:25
So then how the heck do I use LoopSDK?

Formerly The Fixxer
http://www.xiemsoft.cjb.net
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 15th Aug 2005 19:47
Read TF's post. That's how you use it.

*** Coming soon - Network Plug-in - Check my site for info ***
For free Plug-ins and source code http://www.matrix1.demon.co.uk
Briere
19
Years of Service
User Offline
Joined: 28th Feb 2005
Location: Amherst New York, United States
Posted: 15th Aug 2005 21:24 Edited at: 15th Aug 2005 21:24
Ok I have this



and this



The window still doesnt close when I click the X button.

Formerly The Fixxer
http://www.xiemsoft.cjb.net
OSX Using Happy Dude
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 15th Aug 2005 22:05
Try this instead :



You need to make sure LoopSDK() is called to close windows with the X

Come to the third DarkBasic Pro Sci Fi Con - Be there and be square
Blog:http://spaces.msn.com/members/BouncyBrick/
Web Site:http://www.nicholaskingsley.co.uk

Login to post a reply

Server time is: 2024-11-19 00:41:42
Your offset time is: 2024-11-19 00:41:42