Button fails to activate

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

Nomonkeybusiness
Not too shy to talk
Not too shy to talk
Posts: 45
Joined: Wed Sep 09, 2009 11:20

Button fails to activate

Postby Nomonkeybusiness » Sat Oct 10, 2009 10:08

Hi all!
So I've got two layouts loaded into my program. The first takes care of different windows on the sides of the screen, a chatbox and a combatlog and some other stuff.
The other layout is a window that contains a bunch of buttons. A sort of commandcenter. Right now, I have one button on the commandcenter, and it is definately set to enabled and visible.
The problem is that it doesn't seem active, because the image doesn't change on hover, and the callback is never executed. In debug, I can clearly see that the commandcenter is active.
What has happened?

ps. I'm using version 0.6.3 ds.

EDIT: Nevermind, I solved it. Apparently I had to activate it to.

Another problem arises though. The callback-function is a memberfunction from a class called DeploymentState.
This is what I do when I initialize the button:

Code: Select all

CEGUI::Window* pWnd = pSquadWindow->getChildAtIdx(i);
if(i < pForce->getNumSquads())
{
   pWnd->setID(SquadList.at(i)->getSquadID());
   BindButtonToFunction(pWnd, CEGUI::Event::Subscriber(&Deployment::btnPickSquad, m_pDeployment));
   pWnd->enable();
   pWnd->setVisible(true);
   pWnd->activate();
   m_SquadSelectionButtons.push_back(pWnd);
} else
{
   pWnd->disable();
   pWnd->setVisible(false);
}

Code: Select all

void BindButtonToFunction(CEGUI::Window* pWnd, CEGUI::Event::Subscriber& subscriber)
{
   pWnd->subscribeEvent(CEGUI::PushButton::EventMouseClick, &subscriber)
}


Why does not this work?

Edit: Forgot to tell you. The error is in the function

Code: Select all

virtual bool operator()(const EventArgs& args)
{
        return (*d_functor)(args);
}

in the header ceguifunctorpointerslot.h, and it seems that d_functor is equal to NULL.

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: Button fails to activate

Postby CrazyEddie » Sat Oct 10, 2009 10:24

HI,

It sounds like you have transparent parts of windows - or multiple full-screen DefaultWindow root windows - overlapping and preventing visible content beneath from being 'hit'. To alleviate this you should ensure that all of your DefaultWindow roots have the "MousePassThroughEnabled" property set to "True" - with the exception of the actual root, which you set with setGUISheet (only applies to 0.6.x code so you can listen to events on that root if you need to)

[Edit]
The above is maybe not relevant now, and certainly does not answer the functor issue edit.

CE.

Nomonkeybusiness
Not too shy to talk
Not too shy to talk
Posts: 45
Joined: Wed Sep 09, 2009 11:20

Re: Button fails to activate

Postby Nomonkeybusiness » Sat Oct 10, 2009 10:50

Thanks a lot. MousePassThrough ofcourse took care of the first problem. Have you got a clue on why the callback-linking does not work? I send an instance of cDeploymentState along with the function, so it should work...
or should it? That is only my reaction to the function-description.
"SubscriberSlot (bool(T::*function)(const EventArgs &), T *obj)
Creates a SubscriberSlot that is bound to a member function. "

Nomonkeybusiness
Not too shy to talk
Not too shy to talk
Posts: 45
Joined: Wed Sep 09, 2009 11:20

Re: Button fails to activate

Postby Nomonkeybusiness » Sat Oct 10, 2009 11:09

Sorry for double-post. It works now. It seemed that an extra '&' had snuck its way into one of the function. A mod can delete the thread.

jacobb
Just popping in
Just popping in
Posts: 2
Joined: Fri Feb 24, 2006 11:55

Re: Button fails to activate

Postby jacobb » Sat Oct 10, 2009 11:15

Could it be because your passing a pointer to a subscriber that's going out of scope as soon as the call finishes?


Return to “Help”

Who is online

Users browsing this forum: No registered users and 25 guests