Page 1 of 1

[Solved] fire MouseEvent

Posted: Sat May 05, 2007 16:33
by Dirso
Hi,

When the mouse enters a button, I'm setting the focus to this button and I would like this buttons react to keyboard input, for example, if I press <<Enter>> it should act like left click mouse event:

Code: Select all

bool keyReleased( const CEGUI::EventArgs& e )
{
   // what should i put here to fire left click event?
   return true;
}


Thanks,
Dirso

Posted: Sat May 05, 2007 17:06
by Levia

Code: Select all

CEGUI::EventArgs e;
button->fireEvent(CEGUI::Window::EventMouseClick, e);

Thats how you fire an event manually. The method works, but I'm not sure the event works (so im not sure the button will be pushed then, though you could always fire PushButton::EventClicked, which will work)

Code: Select all

CEGUI::EventArgs e;
button->fireEvent(CEGUI::PushButton::EventClicked, e);