Re: Pointer and signals



On 4/2/07, schmirrwurst free fr <schmirrwurst free fr> wrote:
Hi,

I have following question, I usually create an object like this :
button_filechooser = manage( new Gtk::Button(Gtk::Stock::OPEN));

but then I get an error on connecting a handler (that it is of non-class
gtk::button)

button_filechooser.signal_clicked().connect( sigc::mem_fun( *this,
&Dialog_Make_Image::on_button_filechooser_clicked) );

I've tried the same with initialising the object like this :
Gtk:Button button_filechooser(Gtk::Stock::OPEN)
Then it works !

So I guessed it is an issue with pointers, and I tried with a pointer
again with :
*button_filechooser.signal_clicked().connect( sigc::mem_fun( *this,
&Dialog_Make_Image::on_button_filechooser_clicked) );

Doesn't work !? Why ?
How can I work with a pointer, and succed connecting a handler ?



_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list


You're not dereferencing your pointer correctly.

This would be the usual method:
Gtk::Button* b = Gtk::manage( new Gtk::Button( "Text" ) ) ;
b->signal_clicked().connect( sigc::mem_fun( *this, &Foo::bar ) ) ;

Paul Davis



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