Re: connecting signal_timeout()



On 2/24/06, Emilian Nowak <emiml wp pl> wrote:
> Hello,
> I'm using gtkmm2.4, and of course I have some problem:
> In on of my class called:
> class SystemBar
>
> In one of the methods of this class I'm trying to do this:
> Glib::signal_timeout().connect(sigc::ptr_fun(&update_gui_info), 1234);
>
> and this update_gui_info looks like this:
> bool SystemBar::update_gui_info(void);
>
> and I have this error:
> SystemBar.cc|15| error: ISO C++ forbids taking the address of an unqualified
> or parenthesized non-static member function to form a pointer to member
> function.  Say '&SystemBar::update_gui_info'
>
> If I try it like this I have:
> Glib::signal_timeout().connect(sigc::ptr_fun(&SystemBar::update_gui_info),
> 1234);
>
> SystemBar.cc|15| error: no matching function for call to 'ptr_fun(bool (SystemBar::*)())'
>
> What is the correct way of connecting this timeout signal?
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list
>


Try this:
Glib::signal_timeout().connect(sigc::mem_fun(*this,
&SystemBar::update_gui_info), 1234);

i.e. use sigc::mem_fun instead of sigc::ptr_fun.  ptr_fun is for
"plain" C-style functions.  mem_fun is for functions that are
non-static class members
Jonner



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