Re: help with sigc::mem_fun



You bind extra arguments with sigc::bind.
See the libsigc++ tutorial:
http://libsigc.sourceforge.net/libsigc2/docs/manual/html/ch04.html#id2450855

Marko


On Wed, 2006-07-05 at 20:49 +0100, Radu Brehar wrote:
> Hello,
> 
> I'm new to gtkmm, so hope you don't mind me having a
> few basic questions.
> 
> I'll try to be straightforward. I have a button, that
> for example wants to do something with an object which
> is an instance of a class called "Child". In the
> constructor of the button (called ButtonAdd) I do
> 
> m_button.signal_clicked ().connect
> (sigc::mem_fun(*this,
> &ButtonAdd::on_button_clicked,Child *));
> 
> 
> and I have a method
> 
> void ButtonAdd::on_button_clicked(Child *)
> 
> 
> I tried in many different ways, and I know that using
> mem_fun(*this,&ButtonAdd::on_button_clicked)) without
> any other parameter, and having the
> on_button_clicked() method without paramaters works,
> but I don't know how to send this method a parameter.
> 
> Another question: In the main function of my
> application, I have for example
> 
> int main (int argc, char *argv[]){
> 	Gtk::Main kit (argc, argv);
> 	
> 	
> 	ButtonAdd add_button;
> 	Child * c=new Child();
> 	Gtk::Main::run(add_button);
> 	return 0;
> };
> 
> and this is fine. But how do I transmit for example
> the  c object (and instance of Child class) to the
> on_button_clicked() method of ButtonAdd or to the
> constructor of ButtonAdd, which then should transmit
> it over to the on_button_clicked method?
> 
> Thank you in advance for your help.
> Radu.
> 
> 
> 		
> ___________________________________________________________ 
> The all-new Yahoo! Mail goes wherever you go - free your email address from your Internet provider. http://uk.docs.yahoo.com/nowyoucan.html
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list
> 
> 




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