Re: [gtkmm] syntax for MenuElem( .....,slot( static member function ) )



>>In my opinion;
>>Control_class my_cc;

>>list.push_back( MenuElem("Start" ,slot(my_cc,  &Control_class::playback) ) );

That works if my_cc is a menu but I can't get it to work if it is a non-menu class.

Also if use a global variable:

Control_class *cc_ptr;

main()
{
*cc_ptr = new Control_class;

...
}
extern Control_class *cc_ptr;
my_menu_class::my_menu_class()
{


...list.push_back( MenuElem("Start",slot(*cc_ptr,&(cc_ptr->playback) )));
}

I get a message that says something to the effect that I can't make a pointer out of the address of a member function of a "bound variable".

However I can make a "wrapper" function in my_menu_class called playCb() which is just:

extern Control_class *cc_ptr;
int my_menu_class::playCb
{
cc_ptr->playback();
}

and use

list.push_back( MenuElem("Start", slot( *this, &playback) ));

and get things compiled. (Don't know i f this runs correctly yet.)


I am mystified by what can go into slot() and what cannot. Of course, I've never studied Gtk.


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