Re: How to copy data between widgets?




From: RomÃn Gorojovsky <rgorojovsky gmail com>
To: gtk-app-devel-list gnome org
Sent: Tuesday, August 8, 2006 10:07:06 AM
Subject: How to copy data between widgets?

Hi all, sorry if this is a FAQ, but I've been reading the docs and I
couldn't find the answer.  Not being too fluent in english, I couldn't
find it in the archives, since I don't know what to look for.

The problem is the following.  I have a text entry, a button and a
label.  I want the label to display the text in the entry when you
press the button.

So far I've used g_signal_connect_swapped() connecting the "clicked"
signal on the button with a callback that takes a pointer to the label
as data.  But I couldn't pass more than that, so I could't pass a
string nor the text entry.

But you can pass any kind of pointer, so make a struct, something like this:

struct my_data {
  GtkLabel *l;
  GtkEntry *e;
};

Then pass a pointer to an instance of your struct.  Now you have both widgets available in your callback.







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