Common Event handling Function

For help with anything that CEGUI doesn't offer straight out-of-the-box, e.g.:
- Implementation of new features, such as new Core classes, widgets, WindowRenderers, etc. ...
- Modification of any existing features for specific purposes
- Integration of CEGUI in new engines or frameworks and writing of new plugins (Renderer, Parser, ...) or modules

Moderators: CEGUI MVP, CEGUI Team

User avatar
xardias
Just popping in
Just popping in
Posts: 3
Joined: Thu Sep 29, 2005 08:37
Contact:

Common Event handling Function

Postby xardias » Tue Nov 29, 2005 07:44

Hello,

is it possible to get a common event handling function working?
One function that is used to handle different kind of Events (just like one function for every ButtonClicked Message in a window).
Of course I can assign the same function to different Buttons, but i cant get the name of the button pressed, to decide what to do.

in a few words: i want to have a win32 like MessageProc function for cegui windows.

thanks
xardias

User avatar
lindquist
CEGUI Team (Retired)
Posts: 770
Joined: Mon Jan 24, 2005 21:20
Location: Copenhagen, Denmark

Re: Common Event handling Function

Postby lindquist » Tue Nov 29, 2005 10:54

There is no way to determine the name of the event that occured.

But for a PushButton Clicked event you can easily get the window in question.

Consider this event handler:

Code: Select all

bool handler(const EventArgs& e)
{
  Window* w = static_cast<const WindowEventArgs&>(e).window;
  if (w->getName() == "Hello")
  {
    w->setText("Hello world");
  }
  else
  {
    w->setText("Bye world!");
  }
  return true;
}


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 9 guests