Overriding a window close event.

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
dgrafix
Posts: 116
Joined: Sun Nov 18, 2007 2:36 pm

Overriding a window close event.

Post by dgrafix »

I need to be able to either hide the X or the prefered option would be a way of cancelling the window closure and then hiding it instead. The reason is, i would like to maintain the data that has been set in a tools dialogue.

I have an event that fires like this already to record it's last position:

Code: Select all

			case irr::gui::EGET_ELEMENT_CLOSED:

				if (id == TOOLSDIAG)
				{
				    windowposX = ((irr::gui::IGUIWindow*)event.GUIEvent.Caller)->getRelativePosition().UpperLeftCorner.X;
				    windowposY = ((irr::gui::IGUIWindow*)event.GUIEvent.Caller)->getRelativePosition().UpperLeftCorner.Y;
				    
				}

C++/Irrlicht Noob pl3se B p4t1ent.
Visit www.d-grafix.com :)
Seven
Posts: 1034
Joined: Mon Nov 14, 2005 2:03 pm

Post by Seven »

cant you derive a class from the control you are using and then do what you need with the close event?
dgrafix
Posts: 116
Joined: Sun Nov 18, 2007 2:36 pm

Post by dgrafix »

Sorry noob here :D

I have my event detection here:

Code: Select all

               case irr::gui::EGET_ELEMENT_CLOSED:
                {
                   
                    if (id == 5000)
                    {
                        
                       ((irr::gui::IGUIWindow*)event.GUIEvent.Caller)->setVisible(false);
                      i want  something here like event.cancel() or something

                    }

C++/Irrlicht Noob pl3se B p4t1ent.
Visit www.d-grafix.com :)
Sylence
Posts: 725
Joined: Sat Mar 03, 2007 9:01 pm
Location: Germany
Contact:

Post by Sylence »

"event.cancel()" is the same as return true.
The true tells the engine that you accepted the event and it should not be passed along the gui or scene.
Software documentation is like sex. If it's good you want more. If it's bad it's better than nothing.
Post Reply