Event for clicking on "close window button" (X)

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
agamemnus
Posts: 283
Joined: Sun Jan 31, 2010 6:06 pm

Event for clicking on "close window button" (X)

Post by agamemnus »

When I click on the "X" to close my program, it does not un-initialize. The window closes but the program is still running.

How do I detect that the "X" is clicked?
randomMesh
Posts: 1186
Joined: Fri Dec 29, 2006 12:04 am

Re: Event for clicking on "close window button" (X

Post by randomMesh »

Just catch button click events in your event receiver and if it is the close button of your window, take appropriate actions.

Or catch the EGET_ELEMENT_CLOSED event of the window.
"Whoops..."
agamemnus
Posts: 283
Joined: Sun Jan 31, 2010 6:06 pm

Post by agamemnus »

It doesn't seem to activate.

This event applies to the close button of my actual program Window, not just to an Irrlicht GUI window?
Scarabol
Posts: 167
Joined: Sat Jan 03, 2009 5:26 pm
Location: Aachen, Germany

Post by Scarabol »

Hi,

how is your code structured? Like this?

Code: Select all

int main(void)
{
// device = 

while (device->run())
{
// MainLoop
}
// when program reach here the [x] button was pressed
saveallmydata();

return 0; // Programm END
}
MfG
Scarabol
agamemnus
Posts: 283
Joined: Sun Jan 31, 2010 6:06 pm

Post by agamemnus »

No....

I have an onevent function:

bool StackedEventReceiver::OnEvent(const SEvent &event)

It never gets any GUI events when I click the window's "X" or focus/un-focus.
Scarabol
Posts: 167
Joined: Sat Jan 03, 2009 5:26 pm
Location: Aachen, Germany

Post by Scarabol »

Hi,

it can't get this event because your window does not belong to irrlicht it belongs to the OS (Windows).

MfG
Scarabol
Post Reply