Disabling close/dragging on IGUIWindow's

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
Asheh
Posts: 14
Joined: Tue Sep 14, 2004 7:27 pm

Disabling close/dragging on IGUIWindow's

Post by Asheh »

How do i isable the close button and dragging of an IGUIWindow, cheers.

Ash.
jox
Bug Slayer
Posts: 726
Joined: Thu Apr 22, 2004 6:55 pm
Location: Germany

Post by jox »

Disable close button:

GUIWindow->getCloseButton()->setEnabled(false);
or hide it:
GUIWindow->getCloseButton()->setVisible(false);

Disable dragging not without modifying the engine I guess.

jox
It is like it is. And because it is like it is, things are like they are.
alekol
Posts: 3
Joined: Tue Apr 17, 2007 8:44 am

Post by alekol »

Is it posiible now?
To disable dragging?
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

Just copy CGUIWindow.h/cpp, rename the class, and rip out the mouse dragging code. You could also make it inherit directly from IGUIWindow and remove the min/max/close buttons. Instead of creating the window through the GUI environment, just allocate an instance of your new window type directly...

Code: Select all

IGUIElement* myWindow = new CMyWindow(gui, gui->getRootElement(), 0, core::rect<s32>(10, 10, 80, 80);
myWindow->drop();
Or, just use the draw3DWindowBackground() method of the skin to draw what looks like a window.
playerdark
Posts: 64
Joined: Mon Aug 01, 2005 5:06 am

Post by playerdark »

If you still need a clue, here's what I did in the input handler:

if( guienvironment->hasFocus( iguiwindow ))
if( event.MouseInput.Event == EMIE_MOUSE_MOVED )
return true;

something like that, specific to the window you dont want to drag should help you get it donw without altering the engine. It's never a good solution and should not be done for minor stuff like this that should be in the engine, and will hopefully be added one day. I modified the engine because I had no choice and now I am stuck with an older version until I find the time to adapt the new version, so try to avoid that and rather look around if you can do it with some existing tricks :)
Post Reply