Re: [gtk-list] text-entry retrieval



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



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