[Glade-users] Accessing multiple objects from one callback.
- From: damon helixcode com (Damon Chaplin)
- Subject: [Glade-users] Accessing multiple objects from one callback.
- Date: Sun, 10 Dec 2000 16:23:01 +0000
Colin Thomas wrote:
void
on_ok_button1_clicked (GtkButton *button,
gpointer user_data)
{
gchar *entry_text;
entry_text = gtk_entry_get_text(GTK_ENTRY(user_data));
printf("File is: %s\n", entry_text);
}
################################################
Now the question is, if I want my button to look at MORE than one
widget in the window, to extract current values how do I specify
this in glade and/or gtk++ directly. It would appear only one
widget can be passed to a callback at a time ??
Glade provides a lookup_widget() function to get a pointer to any widget
in the same window. So you could use:
void
on_ok_button1_clicked (GtkButton *button,
gpointer user_data)
{
GtkWidget *entry1, *entry2;
entry1 = lookup_widget (GTK_WIDGET (button), "entry1");
entry2 = lookup_widget (GTK_WIDGET (button), "entry2");
...
assuming your widgets are named "entry1" and "entry2".
See the FAQ at http://glade.pn.org
Damon
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]