HandleClicked handler not getting called

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

some_name
Just popping in
Just popping in
Posts: 15
Joined: Sat Mar 10, 2007 00:12

HandleClicked handler not getting called

Postby some_name » Sat Mar 10, 2007 00:26

I am loading a GUI layout, and then, for each widget that is a push button, I subscribe to HandleClicked. I have verified in the debugger that the subscription code is getting called. However, when clicking the buttons, the event handler does not get called.

Here is the code:

Code: Select all

void LuaGui::Build(char const *layout) {
  // This loads a simple dialog with an "OK" and a "Cancel" button
  // and two text fields.
  window_ = CEGUI::WindowManager::getSingleton().loadWindowLayout(
      (CEGUI::utf8*)layout);
  BuildWidgetList(window_);
}

void LuaGui::BuildWidgetList(CEGUI::Window *window) {
  if (window->getType() == "TaharezLook/Button") {
    // I verified that this gets called, and the conn has a refcount
    CEGUI::Event::Connection conn = window_->subscribeEvent(
        CEGUI::PushButton::EventClicked,
        CEGUI::Event::Subscriber(&LuaGui::HandleClicked, this));
    connections_[window->getName()] = conn;
  }
  widgets_[window->getName()] = window;
  for (size_t cnt = window->getChildCount(), i = 0; i < cnt; ++i) {
    BuildWidgetList(window->getChildAtIdx(i));
  }
}

bool LuaGui::HandleClicked(CEGUI::EventArgs const &e) {
  // I never get here, even when clicking the buttons
  if (stateMachine_ != 0) {
    stateMachine_->Stimulate(static_cast<CEGUI::WindowEventArgs const &>(e).window->getName().c_str());
  }
  return true;
}

some_name
Just popping in
Just popping in
Posts: 15
Joined: Sat Mar 10, 2007 00:12

Postby some_name » Sat Mar 10, 2007 00:27

Nevermind. After posting this, I finally saw the underscore that made it not work. It often takes a second set of imagined eyes...


Return to “Help”

Who is online

Users browsing this forum: Google [Bot] and 11 guests