[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gtkmm
Subject:    Re: [gtkmm] clicked and button_press_event
From:       Daniel <dss () home ! se>
Date:       2001-06-29 22:45:19
[Download RAW message or body]

I now realized that both examples were possible solutions... Using "this" in the first example probably wouldn't compile due to other errors. However, as not to experienced in c++ (but i know c pretty well) I find it a little bit confusing that you see "this" and "*this" side by side in the tutorial. At least I got the impression that there were two different implementations of these two signals. Maybe just me...

/daniel

On Fri, 29 Jun 2001 13:10:55 -0700
Joe Yandle <jwy@divisionbyzero.com> wrote:

> > Hello
> > 
> 
> Hi.
> 
> > This is maybe off-topic but I'll ask my question anyway:
> > 
> 
> Questions about our example code are never OT ;)
> 
> > Why do I have to use "*this" in the first example when I can use "this" in the second example?
> > 
> > 1:
> > Gtk::EventBox *eventbox = manage(new Gtk::EventBox());
> > eventbox->button_press_event.connect(slot(*this, &JagsTabWidget::close_clicked));
> > 
> > 2:
> > Gtk::Button *button = manage(new Gtk::Button());
> > button->clicked.connect(slot(this, &JagsTabWidget::close_clicked));
> > 
> 
> Short answer: you can pretty much always use either.
> 
> Long answer: SigC::slot() is both templatized and overloaded, taking
> either T* or T& as its first arg (in the object_slot case, anyway ;).  
> When you're connect()'ing to the current object, you can thus use 
> either (this) or (*this).
> 
> ciao,
> --
> Joe Yandle
> 
> If video games really affected kids, then we'd all be running around in
> dark rooms, munching on pills, and listening to electronic music.
> 
> 

_______________________________________________
to unsubscribe or change your subscription parameters :
http://lists.sourceforge.net/lists/listinfo/gtkmm-main

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic