Button release event?

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
spopo
Posts: 33
Joined: Wed Mar 28, 2007 1:46 pm

Button release event?

Post by spopo »

Is there an event with button release? For example click is irr::gui::EGET_BUTTON_CLICKED. Is there something like irr::gui::EGET_BUTTON_RELEASED ?
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

The click event happens when the mouse is released after it was pressed inside the button area. i.e. a click is a mouse down followed by a mouse up. The click event also happens when the enter/space key are pressed and released while the button has focus.

If you want to know when the mouse is pressed down or released over a control, you have to check that yourself, or make a custom control. You can tell what element is below the mouse by calling getElementFromPoint() on the root gui element.

Travis
Swarmer
Posts: 100
Joined: Mon Apr 16, 2007 7:23 am

Post by Swarmer »

If you're interested in key releases (instead of mouse ones), you detect a KeyInput and check if !event.KeyInput.PressedDown

I think.
arras
Posts: 1622
Joined: Mon Apr 05, 2004 8:35 am
Location: Slovakia
Contact:

Post by arras »

From Irrlicht API:
struct {
wchar_t Char
Character corresponding to the key (0, if not a character).

bool Control
true if ctrl was also pressed

EKEY_CODE Key
Key which has been pressed or released.

bool PressedDown
if not pressed, then the key was left up

bool Shift
true if shift was also pressed

} KeyInput
Swarmer
Posts: 100
Joined: Mon Apr 16, 2007 7:23 am

Post by Swarmer »

Does that mean it was "let up" or was not touched at all? I tried using it and it seems to mean that the key was released.
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

Yes, the PressedDown flag is set to true when the key is pressed and false when the key is released. You don't get keyboard messages for keys that aren't getting touched. That would be silly.

Travis
Swarmer
Posts: 100
Joined: Mon Apr 16, 2007 7:23 am

Post by Swarmer »

Ok cool, because it was worded with bad grammar: "then the key was left up ".
Post Reply