MenuCtrl event inherit

mrmclovin

12-11-2009 21:31:41

Hi,

I have a MenuCtrl. In this menuctrl (mc_1) I have an item which has a menuctrl (mc_2) himself. I have set different function callback for each menuctrl. But when mc_2 triggers an event, it will also trigger mc_1's callback. How can I avoid it?

my.name

12-11-2009 23:28:57


void method1(MyGUI::MenuCtrlPtr _sender, MyGUI::MenuItemPtr _item)
{
if (_sender != mCtrl1)
return;
}

void method2(MyGUI::MenuCtrlPtr _sender, MyGUI::MenuItemPtr _item)
{
if (_sender != mCtrl2)
return;
}

mrmclovin

13-11-2009 13:27:46

Okey, if that's the way to go!

Can I ask you why you have seperate MenuItem and MenuCtrl. Couldn't you merge these together so it'll only be a MenuItem and that MenuItem can have children? And make it possible to set different callback to every MenuItem if you wich to?