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



On Fri, 28 Jun 2002 14:18:49 +0200
Roman Ancerowicz <rancerow poczta onet pl> wrote:

> On Thu, 27 Jun 2002 16:28:05 -0600
> Stephen Tashiro <tashiro zianet com> wrote:
> 
> > >>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.
> 
> I'm forget. If you want to make a class when you would like put your callbacks
                                                        ^^^^^ of course should be where ;-)
> you must derive it from SigC::Object. For me it works.
> 
> > 
> > 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 if this runs correctly yet.)
> > 
> > 
> > I am mystified by what can go into slot() and what cannot.  Of course, I've never studied Gtk.
> > 
> > 
> > 
> 
> 
> -- 
> Roman Ancerowicz rancerow poczta onet pl
> http://www.opensourcepl.org
> Registered Linux user number #205058.My machine has registration number #93996.
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list


-- 
Roman Ancerowicz rancerow poczta onet pl
http://www.opensourcepl.org
Registered Linux user number #205058.My machine has registration number #93996.



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