Re: [gtk-list] gtk-- menufactory callbacks



Marsel Osipov <virtuoso@jps.net> writes:

> Hello.
>     I was wondering if it is possible to connect the menu_entries to
> callbacks which are located in some other classes.

Yes.

> for example
> void MyClass::set_up_menus()
> {
>     menufactory->add_entry("<Main>/File/Load", "L",
> MenuFactoryConnector<MyClass, ignored>(this, &MyOtherClass::callback));?

The parameters to the template are inconsistent :

MyOtherClass myotherclass_obj;

menufactory->add_entry("<Main>/File/Load", "L",
 MenuFactoryConnector<MyOtherClass, ignored>(&myotherclass_obj, &MyOtherClass::callback));?

Note that if you're using egcs, you don't have to use the
MenuFactoryConnector (which is here only to palliate to gcc 2.7
braindead template support). Try this instead :

menufactory->add_entry("<Main>/File/Load", "L",
	&myotherclass_obj, &MyOtherClass::callback, static_cast<char*>0);

> also, if I specify "Ctrl+L" as the accelerator for the Load menu, and
> "Ctrl+S" for save, and "Ctrl+Q" for quit, when the program is run, I get
> "C" as the accelerator for the Quit.  Is that a bug or am I doing
> something wrong?

No idea. Code sample please ?

-- 
					Guillaume.
					http://www.worldnet.fr/~glaurent



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