Re: [gtkmm] Access CheckMenuItem after inserted into menu?



>I am constructing the gui interface for several tools, using gtkmm 
>2.0.2. Just quickly, I am trying to access the original elements 
>inserted into a popup menu. See code at the end. Explination of problem 
>below.
>
>Okay, I have puzzled over this one for a few days now, and know there is 
>some easy answer... I have a popup menu that contains a whole set of 
>CheckMenuItems (the real number is about 50 items that are loaded from a 
>text file).

its a bit late, but instead of:

>         menulist.push_back(Menu_Helpers::CheckMenuElem("abc",
>             SigC::slot(*this, &ClassTest::ChangeLabel)));

do this:

   menulist.push_back (Menu_Helpers::CheckMenuElem ("abc",
             SigC::bind (SigC::slot (*this, &ClassTest::ChangeLabel),
			some_other_arg);

void ClassTest::ChangeLabel (SomeOtherArg arg)
{
	... now you now which one was clicked/activated ...

}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]