need help with sigc::mem_fun1



Hello,

I'm new to gtk, 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_fun1(*this,
&ButtonAdd::on_button_clicked,Child *));

and I have a method 

void ButtonAdd::on_button_clicked(Child *)


but it won't work. I know that using
mem_fun(*this,&ButtonAdd::on_button_clicked)) works,
but I want to send this parameter to the method.

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.


		
___________________________________________________________ 
Inbox full of spam? Get leading spam protection and 1GB storage with All New Yahoo! Mail. http://uk.docs.yahoo.com/nowyoucan.html



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