Re: [gtk-list] Re: Gtk--: how to disconnect (Button) objects



I've tried your advice and changed my class definition accordingly,
adding a

     Connection     c;

to it's private data space. Now when I try

     c = connect_to_method (btn->clicked, this, &callback);

g++ shouts the following message at me:

TFGui.cc:185: warning: initialization of non-const reference
     `class Connection &' from rvalue `Connection'
/usr/local/include/gtk--sigcommon.h:93: warning: in passing
     argument 1 of `Connection::operator =(Connection &)'


I've tried changing 'c' to be of type 'Connection&', but that resulted
in an initialization error (correct, references must be initialized
at definition). What am I doning wrong? How I get rid of this warning
and still keep 'c' a class variable to which I can assign the connection?
I'm still on Gtk+1.0.5 and Gtk--0.9.11 ...

Thanks
--> Robert





Tero Pulkkinen <terop@students.cc.tut.fi> on 08/22/98 08:29:49 PM

Please respond to gtk-list@redhat.com

To:   gtk-list@redhat.com
cc:    (bcc: Robert Gasch)
Subject:  [gtk-list] Re: Gtk--: how to disconnect (Button) objects




Robert_Gasch@peoplesoft.com writes:
> I'm doing a connect_to_method onto a button (Gtk+1.0.5, Gtk--0.9.11)
> which works just fine. The problem I have is how to disconnect the
> button at a later stage.
>
> Connection          *connect;
> Gtk_Button          button;
>
> connect_to_method (button.clicked, this, &callbackMethod);
>
> ... snip ...
>
> // 1st try
> //connect = (Connection *)(button.clicked)    // doesn't compile

It should be:
Connection c;
c=connect_to_method(button.clicked, this, &callbackMethod);
...
c.disconnect();

usually you want to keep the c variable stored inside the object which
creates the connection (and also later disconnects th connection..).

--
-- Tero Pulkkinen -- terop@modeemi.cs.tut.fi --

--
To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null










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