diff options
Diffstat (limited to 'demos/gtk-demo/combobox.c')
-rw-r--r-- | demos/gtk-demo/combobox.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/demos/gtk-demo/combobox.c b/demos/gtk-demo/combobox.c index b0f45d310d..308242b109 100644 --- a/demos/gtk-demo/combobox.c +++ b/demos/gtk-demo/combobox.c @@ -437,7 +437,26 @@ do_combobox (GtkWidget *do_widget) gtk_container_remove (GTK_CONTAINER (combo), gtk_bin_get_child (GTK_BIN (combo))); gtk_container_add (GTK_CONTAINER (combo), entry); - + + /* A combobox with string IDs */ + frame = gtk_frame_new ("String IDs"); + gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0); + + box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); + gtk_container_set_border_width (GTK_CONTAINER (box), 5); + gtk_container_add (GTK_CONTAINER (frame), box); + + combo = gtk_combo_box_text_new (); + gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "never", "Not visible"); + gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "when-active", "Visible when active"); + gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "always", "Always visible"); + gtk_container_add (GTK_CONTAINER (box), combo); + + entry = gtk_entry_new (); + g_object_bind_property (combo, "active-id", + entry, "text", + G_BINDING_BIDIRECTIONAL); + gtk_container_add (GTK_CONTAINER (box), entry); } if (!gtk_widget_get_visible (window)) |