lclick/rclick on a button
Moderators: CEGUI MVP, CEGUI Team
lclick/rclick on a button
How can I tell inside the event handler if the widget received a left click or a mouse click? I need to implement different behaviours for each click in my buttons, but I havent found a clue about how to get that from EventArgs.
Re: lclick/rclick on a button
rogerdv wrote:How can I tell inside the event handler if the widget received a left click or a mouse click? I need to implement different behaviours for each click in my buttons, but I havent found a clue about how to get that from EventArgs.
- From a Forum Search: viewtopic.php?f=2&t=4643
- Form a Wiki Search: http://www.cegui.org.uk/wiki/index.php/Event_reference
- From the API Docs: http://cegui.org.uk/api_reference/class ... tArgs.html
- From a Google Search: http://www.google.com/search?q=cegui+event+mouse+click
- From the source-header: Handlers are passed a const MouseEventArgs reference
If somebody helps you by replying to your thread, upvote him/her as a thanks! Make sure to include your CEGUI.log and everything you tried when posting! And remember that we are not magicians!
Re: lclick/rclick on a button
Thanks for the help, but the solution in the forum thread produces an error. the problem is that in the same event handler Im managing 10 buttons, so, this is the code:
I get an error at "const CEGUI::MouseEventArgs& args = " saying
/home/roger/projects/ark-rpg/trunk/ark-rpg/src/gsGame.cpp|615|error: declaration of ‘const CEGUI::MouseEventArgs& args’ shadows a parameter|
Is there some way to solve this other than creating 10 different event handlers?
Code: Select all
bool gsGame::slots_OnClick(const CEGUI::EventArgs &args)
{
CEGUI::String buttonName = static_cast<const CEGUI::WindowEventArgs&>(args).window->getName();
const CEGUI::MouseEventArgs& args = reinterpret_cast<const CEGUI::MouseEventArgs&>(args);
if (buttonName=="slot1") { //execute action associated to slot
***
I get an error at "const CEGUI::MouseEventArgs& args = " saying
/home/roger/projects/ark-rpg/trunk/ark-rpg/src/gsGame.cpp|615|error: declaration of ‘const CEGUI::MouseEventArgs& args’ shadows a parameter|
Is there some way to solve this other than creating 10 different event handlers?
Re: lclick/rclick on a button
Code: Select all
bool gsGame::slots_OnClick(const CEGUI::EventArgs &args)
{
const CEGUI::MouseEventArgs& margs = static_cast<const CEGUI::MouseEventArgs&>(args);
CEGUI::String buttonName = margs.window->getName();
if (buttonName=="slot1") { //execute action associated to slot
***
Just give it a different name from the parameter...
Who is online
Users browsing this forum: No registered users and 11 guests