lock/pin a window

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
pin3
Posts: 108
Joined: Fri Oct 06, 2006 8:50 pm
Contact:

lock/pin a window

Post by pin3 »

how do you lock the position of a window so it doest move (irrlicht gui window IGUIWindow )
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

You could try window->setEnabled(false);. If that doesn't work, you have a few options. You could create an event receiver that consumes mouse button events when the element under the cursor is a gui window. Something like this...

Code: Select all

virtual MyEventReceiver::OnEvent(const SEvent& event)
{
  if (event.EventType == EET_MOUSE_INPUT_EVENT)
  {
    if (event.MouseInput.EventType == EMIE_LMOUSE_PRESSED_DOWN || event.MouseInput.EventType == EMIE_LMOUSE_LEFT_UP)
    {
      const core::position2df point (event.MouseInput.X, event.MouseInput.Y);
      gui::IGUIElement* element = gui->getElementFromPoint(point);
      assert (0 != element);

      return element->getType() == gui::EGUIET_WINDOW;
    }
  }

  return false;
}
CuteAlien
Admin
Posts: 9721
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

Another option is to switch to svn trunk (or wait for 1.6). It got a new function setDraggable.
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
pin3
Posts: 108
Joined: Fri Oct 06, 2006 8:50 pm
Contact:

Post by pin3 »

Updated to SVN, no setDraggable funtion though

never mind got it to work
CuteAlien
Admin
Posts: 9721
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

pin3 wrote:Updated to SVN, no setDraggable funtion though
It's in IGUIWindow.
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
pin3
Posts: 108
Joined: Fri Oct 06, 2006 8:50 pm
Contact:

Post by pin3 »

I just did t show in intelisense, typing out the funciton worked.
Post Reply