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

Re: Sending text input to code from GTK Widgets



Erik Mouw wrote:
> 
> John Robicheau wrote:
> >   I have some text entry boxes in an app I am designing, and I can't
> > figure out how to get the text entered in the text entry area into the
> > backing C code.
> >
> >   What kind of signal would be used for this?  Or is it all in the C
> > coding?
> >
> >   It is for a database creation Option panel, and one feild *has* to be
> > a text entry....
> 
> Use gtk_entry_get_text() to get the text. It is better not to connect
> a signal to the entry, because in that way you have to respond to
> each and every keypress event while you're actually only interested
> in the value after the user typed everything. The best way is to get
> the text at the moment the user presses the Apply/Ok/Update/whatever
> button.

There is the activate signal on GtkEditable, activated by return in a
GtkEntry. You can attach to that, and it will only be called when the
users hits return in the entry.  When you have got the activate signal,
then get the text with gtk_entry_get_text().

-- 
René Seindal (rene@seindal.dk)			http://www.seindal.dk/rene/



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