How to stop the scene while handling GUI events?
How to stop the scene while handling GUI events?
My program has an operating mode called MODE_ROTATE to rotate objects. This operating mode is triggered when the user presses 'r' key.
Now, the problem is, as you can see in the above picture, the user would like to save the scene and type the file name which is "ABC.irr" meaning that 'r' has been pressed and the operating mode is changed from nothing to MODE_ROTATE.
How to stop the event receiver when doing things in the GUI elements?
how to ignore the things in the background when the GUI element is focused?
Also, if the element is focused, that means the user clicks the left mouse button on the element meaning that EMIE_LMOUSE_PRESSED_DOWN is also triggered.
How to handle this case in which EMIE_LMOUSE_PRESSED_DOWN and EGET_ELEMENT_FOCUSED happen at the same time?
Code: Select all
case EGET_ELEMENT_FOCUSED:
{
//what to do?
}break;
How to handle this case in which EMIE_LMOUSE_PRESSED_DOWN and EGET_ELEMENT_FOCUSED happen at the same time?
With env->getRootGUIElement()->getElementFromPoint
you can check which element is below the mouse. If it is anything but the RootGUIElement itself then you are probably over a gui-element and don't want to handle those mouse-events for 3D selection.
you can check which element is below the mouse. If it is anything but the RootGUIElement itself then you are probably over a gui-element and don't want to handle those mouse-events for 3D selection.
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
How to check if env->getRootGUIElement()->getElementFromPoint(mouse_click_pos); returns a gui element other than the root one? by ID?CuteAlien wrote:With env->getRootGUIElement()->getElementFromPoint
you can check which element is below the mouse. If it is anything but the RootGUIElement itself then you are probably over a gui-element and don't want to handle those mouse-events for 3D selection.
Apart from mouse clicking problem, how to solve the changing mode problem?
Should I use
Code: Select all
case EGET_ELEMENT_FOCUSED:
{
}
Code: Select all
case EET_KEY_INPUT_EVENT :
{
}
sorry.....I still do not get it....
Could you please give me some sample code?
If I click on the GUI element (not root), it will be focused.
That means EGET_ELEMENT_FOCUSED will be checked.
But....by clicking the GUI element, that means EMIE_LMOUSE_PRESSED_DOWN will also be checked.
How to disable the checking of EMIE_LMOUSE_PRESSED_DOWN if EGET_ELEMENT_FOCUSED is being checked?
Any sample code?
Could you please give me some sample code?
If I click on the GUI element (not root), it will be focused.
That means EGET_ELEMENT_FOCUSED will be checked.
But....by clicking the GUI element, that means EMIE_LMOUSE_PRESSED_DOWN will also be checked.
How to disable the checking of EMIE_LMOUSE_PRESSED_DOWN if EGET_ELEMENT_FOCUSED is being checked?
Any sample code?
You don't suppress. Instead you have for example 2 states - GUI-state and Scene-state. Where you set that is up to you - only on clicks, or even on mouse-moves. And in all events where you don't want to act in one state you check for that. So if you don't want to the event to pass on in EMIE_LMOUSE_PRESSED_DOWN when you are in Scene-state you check for that and return true for that event (which means it won't be passed on any further).
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