How can i break/supress the Quit-Event

Hello,

(sorry for my bad english, i came from germany)

i’m starting one week ago with SDL. I use SDL.Net (SDL dotnet) under
Visual Basic 9, my OS ist WindowsXP.
At the moment i have a problem, i think its trival, but is’nt it for me.

I start with a Windows.Forms-Application (not Console-Application!) and
by clicking an an Button i create a SDL-Window with Video.SetVideo …
that works great and i can render frames for my test-programm in the
tick-event-handler. Why i use a Windows.Forms-Application? I must
display a WebBrowser-Control by example and need some Windows to display
Data outside of the SDL-Window.

Now my Problem:
The SDL-Windows have a red X in the right upper corner to close the
SDL-Window and when i click on it (or Press ALT-F4), the whole
Application will close, not only the SDL-Window. I have installed a
Eventhandler to catch the sdl-quit-Event, but find not way to break the
quiting-process.

I must catch the quit-event, so that i can ask the user “Quit, Yes or
No”. I can display a messagebox, but i can not break the quit-event.

I dont have found helpful code-examples. I search over three days and
read a lot of Expamles in C, C++ and C# and two in Visual Basic :wink:

I think its a simple problem … please help me to master it.

Greetings, Valerie

This isn’t an SDL issue. What you need is to find a VB9 handler for
the window’s Quit or OnExit event (I don’t have VS installed right now
or I’d look up the actual event name for you). In VS2008 I know
there’s a way to do this, maybe check around some VB forums.

Good luck :)On Thu, Mar 11, 2010 at 9:03 PM, EightBitWitch wrote:

Hello,

(sorry for my bad english, i came from germany)

i’m starting one week ago with SDL. I use SDL.Net (SDL dotnet) under Visual
Basic 9, my OS ist WindowsXP.
At the moment i have a problem, i think its trival, but is’nt it for me.

I start with a Windows.Forms-Application (not Console-Application!) and by
clicking an an Button i create a SDL-Window with Video.SetVideo … that
works great and i can render frames for my test-programm in the
tick-event-handler. Why i use a Windows.Forms-Application? I must display a
WebBrowser-Control by example and need some Windows to display Data outside
of the SDL-Window.

Now my Problem:
The SDL-Windows have a red X in the right upper corner to close the
SDL-Window and when i click on it (or Press ALT-F4), the whole Application
will close, not only the SDL-Window. I have installed a Eventhandler to
catch the sdl-quit-Event, but find not way to break the quiting-process.

I must catch the quit-event, so that i can ask the user “Quit, Yes or No”. I
can display a messagebox, but i can not break the quit-event.

I dont have found helpful code-examples. I search over three days and read a
lot of Expamles in C, C++ and C# and two in Visual Basic :wink:

I think its a simple problem … please help me to master it.

Greetings, Valerie


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Thanks for your anwser,

yes, i can catch den Close-Event of the Main-Window and it effects, when
i click the Close-Button on the Main-Window. But it have no effect, when
i click on Close-Button on the SDL-Window, the Main-Window close, here i
dont can catch the close-Event of the Main-Window. I dont understand it.

Justin Coleman schrieb:> This isn’t an SDL issue. What you need is to find a VB9 handler for

the window’s Quit or OnExit event (I don’t have VS installed right now
or I’d look up the actual event name for you). In VS2008 I know
there’s a way to do this, maybe check around some VB forums.

Good luck :slight_smile:

On Thu, Mar 11, 2010 at 9:03 PM, EightBitWitch <@EightBitWitch> wrote:

Hello,

(sorry for my bad english, i came from germany)

i’m starting one week ago with SDL. I use SDL.Net (SDL dotnet) under Visual
Basic 9, my OS ist WindowsXP.
At the moment i have a problem, i think its trival, but is’nt it for me.

I start with a Windows.Forms-Application (not Console-Application!) and by
clicking an an Button i create a SDL-Window with Video.SetVideo … that
works great and i can render frames for my test-programm in the
tick-event-handler. Why i use a Windows.Forms-Application? I must display a
WebBrowser-Control by example and need some Windows to display Data outside
of the SDL-Window.

Now my Problem:
The SDL-Windows have a red X in the right upper corner to close the
SDL-Window and when i click on it (or Press ALT-F4), the whole Application
will close, not only the SDL-Window. I have installed a Eventhandler to
catch the sdl-quit-Event, but find not way to break the quiting-process.

I must catch the quit-event, so that i can ask the user “Quit, Yes or No”. I
can display a messagebox, but i can not break the quit-event.

I dont have found helpful code-examples. I search over three days and read a
lot of Expamles in C, C++ and C# and two in Visual Basic :wink:

I think its a simple problem … please help me to master it.

Greetings, Valerie


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Thanks for your anwser,

yes, i can catch den Close-Event of the Main-Window and it effects, when i
click the Close-Button on the Main-Window. But it have no effect, when i
click on Close-Button on the SDL-Window, the Main-Window close, here i dont
can catch the close-Event of the Main-Window. I dont understand it.

I believe this may be of some use:

http://www.libsdl.org/cgi/docwiki.cgi/SDL_QuitEvent

In your event loop, if you check event->type against SDL_QUIT, you should be
able to then ignore the event if you want, making it impossible to close the
window, according to the documentation ?On Thu, Mar 11, 2010 at 8:50 PM, EightBitWitch wrote:


The reason the VB Main Window’s Unload/Terminate/whatever-event-it-is works
on the Main Window… and you can catch that… is because the VB Main
Window is handled by VB. When you create an SDL screen, the new SDL window
is handled by SDL, not VB.


My apologies if I’m speaking out of my ass, it has been several years since
I have done VB :slight_smile:

-Will

I have read the article, but i is not helpful for me.
My idea is, that it is problem of the sdl.net-Implementation, that is
not i all like the original. Is SDL.Net too simple for good programming?

By Example:
To start the SDL.Net internal Event-loop i wrote Events.Run (starts in a
new thread).
for catch an Event i installed before an Eventhandler like this:
AddHandler Events.Quit, AdressOf onSDLQuit

The Eventhandler ist this:
Sub onSDLQuit (ByVal Sender as Object, ByVal e as QuitEventArgs)
’**** The handler is now Empty
’**** Events.QuitApplication() 'Shutdown the SDL
End Sub

I have a empty QuitEvent-Handler, but the MainWindows stilclose by
clicking on the CloseButton of the SDL-Window.

I do this like the official sdl.net-Examples for Visual Basic, see:
http://cs-sdl.sourceforge.net/index.php/Events_VB.NET
http://cs-sdl.sourceforge.net/index.php/HelloWorld_VB.NET

Another difference:
The Poll-Method in sdl.net dont extract an event, so that i dont can
look at on and do the right. In sdl.net the poll-Method raise all events
directly. I dont can check events to react on it. The only way seems to
be the EventHandler, but it have an own-live (in german: Eigenleben).

Will Langford schrieb:> On Thu, Mar 11, 2010 at 8:50 PM, EightBitWitch <@EightBitWitch mailto:EightBitWitch> wrote:

Thanks for your anwser,

yes, i can catch den Close-Event of the Main-Window and it
effects, when i click the Close-Button on the Main-Window. But it
have no effect, when i click on Close-Button on the SDL-Window,
the Main-Window close, here i dont can catch the close-Event of
the Main-Window. I dont understand it.

I believe this may be of some use:

http://www.libsdl.org/cgi/docwiki.cgi/SDL_QuitEvent

In your event loop, if you check event->type against SDL_QUIT, you
should be able to then ignore the event if you want, making it
impossible to close the window, according to the documentation ?


The reason the VB Main Window’s Unload/Terminate/whatever-event-it-is
works on the Main Window… and you can catch that… is because the
VB Main Window is handled by VB. When you create an SDL screen, the
new SDL window is handled by SDL, not VB.


My apologies if I’m speaking out of my ass, it has been several years
since I have done VB :slight_smile:

-Will



SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

.NET in general is too simple for good programming. Even Microsoft doesn’t use it in their own programs, which ought to tell you something. While everyone’s wasting time trying to catch up to the latest technology, they’re quietly plugging away with time-tested, proven code. It’s a classic example of Fire And Motion. ( http://www.joelonsoftware.com/articles/fog0000000339.html ) Or, in layman’s terms, “do as I say, not as I do, suckers!”________________________________
From: admin@eightbitwitch.de (EightBitWitch)
Subject: Re: [SDL] How can i break/supress the Quit-Event

I have read the article, but i is not helpful for me.
My idea is, that it is problem of the sdl.net-Implementation, that is
not i all like the original. Is SDL.Net too simple for good programming?

I have read the article, but i is not helpful for me.
My idea is, that it is problem of the sdl.net-Implementation, that is not i
all like the original. Is SDL.Net too simple for good programming?

By Example:

Everything I’ve read on the SDL.net site suggests what you have should
probably work. I’m at a loss. There are others around here that are
knowledgeable that might be able to help. Sorry I could not help more.

You might be able to get some help at:
http://cs-sdl.sourceforge.net/forum/index.php ?

-WillOn Thu, Mar 11, 2010 at 9:25 PM, EightBitWitch wrote:

I have found the or one solution:
The SDL-Window must be the Main-Windows of the
Windows.Forms-Application. Start
Then works the Quit-Eventhandler as expected. It is a Problem betwenn
sdl.net and Windows.Forms. Startobject must be the “Sub Main” of a Module.

But now, the SDL-Rendering (over the Tick-Event) stops while i move a
Window (by mouse) of my Program (SDL-Window or one of my added
Windows.Forms-Windows).
Is this the normal behavior?

EightBitWitch schrieb:> Hello,

(sorry for my bad english, i came from germany)

i’m starting one week ago with SDL. I use SDL.Net (SDL dotnet) under
Visual Basic 9, my OS ist WindowsXP.
At the moment i have a problem, i think its trival, but is’nt it for me.

I start with a Windows.Forms-Application (not Console-Application!)
and by clicking an an Button i create a SDL-Window with Video.SetVideo
… that works great and i can render frames for my test-programm in
the tick-event-handler. Why i use a Windows.Forms-Application? I must
display a WebBrowser-Control by example and need some Windows to
display Data outside of the SDL-Window.

Now my Problem:
The SDL-Windows have a red X in the right upper corner to close the
SDL-Window and when i click on it (or Press ALT-F4), the whole
Application will close, not only the SDL-Window. I have installed a
Eventhandler to catch the sdl-quit-Event, but find not way to break
the quiting-process.

I must catch the quit-event, so that i can ask the user “Quit, Yes or
No”. I can display a messagebox, but i can not break the quit-event.

I dont have found helpful code-examples. I search over three days and
read a lot of Expamles in C, C++ and C# and two in Visual Basic :wink:

I think its a simple problem … please help me to master it.

Greetings, Valerie


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org