Re: data in signal association. (user_data on GTK+)



2010/1/20 John Holmes <merli renato gmail com>:
>    The following code don´t work:
>
>    Gtk::MenuItem * tmp_item;
>    refXml->get_widget("mn_add_dvd", tmp_item);
>
>    (tmp_item)->signal_activate().connect( sigc::bind(  sigc::slot (*this,
> app::cb_menu_click, "test")));

The first argument of sigc::bind is the slot, and the second is the
argument that should be bound. In general, using the sigc::slot
constructor directly is rarely necessary. Here's a correct example:

void cb_menu_click(const char *test_param) { ... }
...
tmp_item->signal_activate().connect(sigc::mem_fun(*this,
&App::cb_menu_click), "test");

Regards, Krzysztof Kosiński


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