On Sun, 2003-09-21 at 05:59, Gus Koppel wrote:
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 button 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 () http://developer.gnome.org/doc/API/2.0/gtk/GtkEntry.html#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 function). 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
[...] or keeping your important widgets in a struct, who's location (pointer) is passed in as the user_data to your button's "clicked" callback (or declared static/global). [...] or passing the entry as the user_data to your button's "clicked" callback. -- Peace, Jim Cape http://ignore-your.tv "It is literally true that, like Christianity, Socialism has conquered the world by defeating itself." -- Alexander Berkman, ABC of Anarchism
Attachment:
signature.asc
Description: This is a digitally signed message part