[10120] in The GTK GIMP ToolKit mailing list archive
[gtk-list] Re: text-entry retrieval
daemon@ATHENA.MIT.EDU (Jan Gentsch)
Sun Nov 15 07:09:46 1998
Date: Sun, 15 Nov 1998 13:03:00 +0100
From: Jan Gentsch <gentsch@ifm.uni-hamburg.de>
To: gtk-list@redhat.com
Resent-From: gtk-list@redhat.com
Reply-To: gtk-list@redhat.com
You would need to give us some more information really.
Tom Vogt wrote:
>
> the gtk_entry widget gives me a headache.
>
> I have a huge lot of variables that I have in a number of entry fields.
> there is no need for a buffer, i.e. whenever the user changes what is
> written in the fields, the variables should change, too.
>
> it seems that setting the entry does create a copy, because changing the
> entry doesn't change the variable.
Yes, it does. It copies the contents of your variable into the entry
internal
variable "gchar *text".
> I have experimented with a general callback that gets the variable which
> belongs to the textfield passed as the data structure, but that won't work
> either. creating individual callbacks for each and every entry is not an
> option.
What are you trying to do. Something like this should surely work.
GtkEntry *field[30];
ari[30];
--->create the Entries
for(i=0; i<30; i++)
gtk_signal_connect(GTK_OBJECT(field[i]), "changed",
GTK_SIGNAL_FUNC(read_out_cb), &vari[i]);
---> and the callback function does something like
read_out_cb(GtkWidget *w, gpointer *data)
{
VariableType *var = (VariableType *)data;
gchar *text;
text = gtk_entry_get_text(w);
*var = parse_out_text_to_variable(text);
}
>
> how do I go about this? there must be a simple way to do it, I hope. but I
> couldn't find anything in the tutorial or faq.
>
Jan
--
To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null