Re: newbie question:about getting an input via button

stan huang wrote:

 Hello, can anyone please help me? I am trying to get
an user input via the text entry box by clicking on a
in the application. So once they enter into the text
entry and press the button, I will then collect the
data with some callback function. I really don't know
how to connect the button to the entry so it would
catch the text entry's "clicked" signal and then call
the callback function.

The way to do this is to use the function gtk_entry_get_text ()
There is no way for an implicit connection, like GTK delivering the
contents of an input field to a button by itself. If you want to process
the contents you have to query them by yourself (in your button callback

To access the input field from your button's callback function you need to
get a pointer to it. You can do this by

- creating / keeping your own global variables of pointers to all
  (important) widgets

- using Glade's lookup_widget () function (only available if GUI is
  created by Glade)

- using a more generic widget localisation function like my

For the latter two you should name your (important) widgets properly.

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