Re: [sigc] libsigc++ tutorial



woo-oh! Something so simple!
Thanks, man. 

-----Original Message-----
From: libsigc-list-bounces gnome org [mailto:libsigc-list-bounces gnome org] On Behalf Of Chow Loong Jin
Sent: Monday, August 20, 2012 2:16 PM
To: libsigc-list gnome org
Subject: Re: [sigc] libsigc++ tutorial

On 19/08/2012 00:46, Arbol One wrote:
> Using Gtkmm - 2.22 on  Win7 with MinGW.
> 
>  
> 
>  
> 
> Well, this is what I have done so far, based on what I understand from 
> the
> libsigc++ tutorial, what am I doing wrong?
> 
>  
> 
> class myEntry : virtual public Gtk::VBox {
> 
> private:
> 
>     Gtk::Entry* ntrTest;
> 
>     Gtk::Label* lblTest;
> 
>    
> 
> public:
> 
>    sigc::signal<void> signal_detected; //  gcc complains, if it is private??

This is the signal you're attempting to connect to. It's sigc::signal<void>, meaning that the function signature for slots that you are connecting to it should be void func(). However, the function you are connecting to it returns a bool, as can be seen below:

As for gcc complaining if it is private, that is because non-friend classes cannot access private members of a class. You were attempting to connect to myEntry::signal_detected (a private member) from within runner::runner().

> [...]
>
> bool runner::warn_people() {
> 
>     std::cout << "Warning people" << std::endl;
> 
>     return false;
> 
> }
>
> [...]
>
> runner::runner() {
> 
>     btnhb = Gtk::manage(new Gtk::HBox);
> 
>     vb = Gtk::manage(new Gtk::VBox);
> 
>     mentry = Gtk::manage(new jme::myEntry);
> 
> ////////// >> compile time error !!
> 
>     mentry->signal_detected.connect( sigc::mem_fun(*this, 
> &runner::warn_people) ); [..]

--
Kind regards,
Loong Jin




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