change window close button press 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
irruser
Posts: 34
Joined: Thu Jul 26, 2007 10:18 am
Location: Scotland

change window close button press event?

Post by irruser »

hello,
i was wondering how i would go about changing the press event of an irrlicht windows close button. i have tried giving it an id then using this in the Gui event but instead of hiding the window(the desired effect i want) it actually closes it (the normal function it caries out). i have also tried creating a button at the same position with the window as its parent but it doesn't show and is hidden behind the windows title. so i was wondering is there a way to create a button at the same position that will always be on top of its parent window or to change the event when the close button is pressed. :D
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

You can't change the events, that's not in your control, but there are some options i guess.

I think maybe you can remove the close button from the window? Is that not an option? Check IGUIWindow in the API to see.

Or you could write your own window class, using the code of the current window class and change how it works, so maybe then you could change the close button event, or you could remove the button altogether from the code and replace it with your own.
Image Image Image
irruser
Posts: 34
Joined: Thu Jul 26, 2007 10:18 am
Location: Scotland

Post by irruser »

yeah you can remove the close button well you can hide and disable it. the problem is creating the new button that will stay on top of the windows title. what i mean by this is when you create the button in the same location as the old one it wont show if the parent is the window. this is down to the order they are being drawn in and im not to sure how to change this. unless i create the button before i create the window.... ill try this then get back to you thanks for the reply.
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

You can absorb the EGET_ELEMENT_CLOSED event by returning true for that in your eventreceiver.

The order of drawing can be influenced by calling parent->bringToFront(element) for element which should be drawn on top.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Post Reply