I couldn't figure out how to set a derived window modal. I derived the class IGUIWindow but there is no variable to set the window modal like with the function addWindow. Could someone explain me how to get my own window modal too?
I asked in the beginners help first, but no one could answer my question.
Thanks alot
set derived Window modal
Derived Modal GUI Element
Hey everyone!
I don't want to create another thread for the same problem so I'm posting in here:
Can somebody explain to me how to make my derived GUI element modal?
I've been reading through the source and I can't seem to find a method or anythin; I also saw that Niko said that it's just a matter of setting one huge invisible parent but I don't quite get it...
Can someone please explain to me how to achieve it or point me out in the right direction?
Any help would be greatly appreciated.
I don't want to create another thread for the same problem so I'm posting in here:
Can somebody explain to me how to make my derived GUI element modal?
I've been reading through the source and I can't seem to find a method or anythin; I also saw that Niko said that it's just a matter of setting one huge invisible parent but I don't quite get it...
Can someone please explain to me how to achieve it or point me out in the right direction?
Any help would be greatly appreciated.
Wow, reviving a 6 year old thread ^^
And the current solution is that gui-elements don't know themselves if they are modal. Instead you set a modal screen as parent. To do that - first create your element. The add the modal (addModalScreen in IGUIEnvironment) and lastly add your element as child to that modal. And yeah - that strange order is necessary as you can run in rather complex focus troubles otherwise.
You can see some examples of this in CGUIEnvironment.cpp for example in CGUIEnvironment::addWindow.
And the current solution is that gui-elements don't know themselves if they are modal. Instead you set a modal screen as parent. To do that - first create your element. The add the modal (addModalScreen in IGUIEnvironment) and lastly add your element as child to that modal. And yeah - that strange order is necessary as you can run in rather complex focus troubles otherwise.
You can see some examples of this in CGUIEnvironment.cpp for example in CGUIEnvironment::addWindow.
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
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Worked, but...
Hey Cute Alien, thanks for answering so fast
Anyway, I did what you said and it worked perfectly!!!
The elements now behave like modal windows, but now I have another problem:
I was handling the events of those GUI elements in another gui element that I used to set as parent, but now that the parent is the modal screen, how can I manage those events?
Any idea?
THANKS!!!
Anyway, I did what you said and it worked perfectly!!!
The elements now behave like modal windows, but now I have another problem:
I was handling the events of those GUI elements in another gui element that I used to set as parent, but now that the parent is the modal screen, how can I manage those events?
Any idea?
THANKS!!!
Sorry, I don't get what exactly you try to do there. The idea of a modal is that all gui-events except the one for the modal window are blocked - and that's basically what this modal element does.
Your eventreceiver (the one you set for the device) can still get all normal events.
But maybe just try to explain what you want to reach in the end.
Your eventreceiver (the one you set for the device) can still get all normal events.
But maybe just try to explain what you want to reach in the end.
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
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Ok, I'm gonna try explaining myself (story of my life )
I have an event receiver that I use to handle ALL gui events, that's the one I set to the Device.
My derived gui elements have as a parent the rootGuiElement so the eventreceiver can get all of those inputs.
If, by making the derived gui modals I have to change the parent (from rootGUIElement to ModalScreen) is the eventreceiver still able to handle those events?
If so... I have a nasty nasty bug somewhere in my code, cause after I set the derived gui elements as modal, the event handling stopped working.
THANKS, THANKS!
Thans for all your help, you don't know how useful it has been!
I have an event receiver that I use to handle ALL gui events, that's the one I set to the Device.
My derived gui elements have as a parent the rootGuiElement so the eventreceiver can get all of those inputs.
If, by making the derived gui modals I have to change the parent (from rootGUIElement to ModalScreen) is the eventreceiver still able to handle those events?
If so... I have a nasty nasty bug somewhere in my code, cause after I set the derived gui elements as modal, the event handling stopped working.
THANKS, THANKS!
Thans for all your help, you don't know how useful it has been!
Sorry, not sure right now. It looks to me like the modal element does call it's parent and pass the events on except for focus-changes.
Maybe you did not set the parent of the modal to the rootGuiElement?
Maybe you did not set the parent of the modal to the rootGuiElement?
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
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm