Just like when you click and drag on a button or scroll bar in a draggable window, the window that it is in won't be dragged. But if you click on an empty part of the window or on a statictext, the window will be dragged.
I have some elements (Specifically, IGUIImages) that I don't want to drag the window when the user clicks+drags on them. But I still want the window to be draggable otherwise (in other words, I'd rather not make the window undraggable).
Is this possible?
Make a GUI element not drag a window its in
Re: Make a GUI element not drag a window its in
Returning true for mouse-events in those children should work. Dragging starts on EMIE_LMOUSE_PRESSED_DOWN so catching that should do the trick.
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
Re: Make a GUI element not drag a window its in
While I understand the logic behind what you are saying, I'm not really sure how to implement it. Could you give me an example?
I dont want to stop all images from dragging the window, only 2 in particular in my program.
I dont want to stop all images from dragging the window, only 2 in particular in my program.
Re: Make a GUI element not drag a window its in
Ah right, not so trivial as you can't catch EMIE_MOUSE_MOVED for specific events in your receiver. Hm... then catch it generally and do a check for guienv->getRootGUIElement()->getElementFromPoint() and check if you receive one of those elements which you want to exclude.
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
Re: Make a GUI element not drag a window its in
Well I got it working.
I have a variable in my receiver which I needed for something else, called hoveredId, which just contains the id of the currently hovered element (which is set whenever the event receiver gets a EGET_ELEMENT_HOVERED event). So I just reused that, and did this:
Where id would be the id of the element to not make the window drag when dragged on.
Thanks.
I have a variable in my receiver which I needed for something else, called hoveredId, which just contains the id of the currently hovered element (which is set whenever the event receiver gets a EGET_ELEMENT_HOVERED event). So I just reused that, and did this:
Code: Select all
if (event.MouseInput.Event == EMIE_LMOUSE_PRESSED_DOWN)
{
if (hoveredId == id)
return true;
}
Thanks.