Page 1 of 1

Button release event?

Posted: Wed May 02, 2007 10:53 pm
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 ?

Posted: Wed May 02, 2007 11:04 pm
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

Posted: Thu May 03, 2007 12:29 am
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.

Posted: Thu May 03, 2007 8:49 am
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

Posted: Thu May 03, 2007 3:31 pm
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.

Posted: Thu May 03, 2007 6:18 pm
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

Posted: Thu May 03, 2007 6:50 pm
by Swarmer
Ok cool, because it was worded with bad grammar: "then the key was left up ".