FAQ wiki problem

Forum for general chit-chat or off-topic discussion.

Moderators: CEGUI MVP, CEGUI Team

Not too shy to talk
Not too shy to talk
Posts: 22
Joined: Mon Jul 31, 2006 01:06

FAQ wiki problem

Postby kiolakin » Sat Aug 05, 2006 02:37

Just thought someone might want to correct this...

What is the correct way to subscribe for an event?

Event notification is a vital aspect of GUI programming. CEGUI handles those using subscribers. In order to subscribe a window for an event, you have to call the method 'Window::subscribeEvent', passing the function to be called when the specified event occurs, and the instance on which the method is called.

Code: Select all

class MyButtonHandler
    PushButton* mButton;

    MyButtonHandler::MyButtonHandler(PushButton* btn) : mButton(btn)
        btn->subscribeEvent(PushButton::EventClicked, Event::Subscriber(MyButtonHandler::ButtonClicked,this));
        //This function gets called when the button is clicked
        std::cout << "Button clicked" << std::endl;

should be:

Code: Select all

bool MyButtonHandler::ButtonClicked(const EventArgs &e)

which is not a huge deal, but it may be enough to confuse someone.[/quote]

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

Postby lindquist » Sat Aug 05, 2006 06:42

thanx for the report

Return to “Offtopic Discussion”

Who is online

Users browsing this forum: No registered users and 2 guests