Hi Dru, On Mon, 2005-03-21 at 00:57 +1200, Dru wrote: > Hello. I'm trying to make a GtkComboBoxEntry show what item you have > currently selected in its popup list > and I'm not having much luck. The problem is the list is not showing > what your current selection is. It > also doesnt scroll to your current selection is, so if you have a large > list in a combobox and want to select > the next item in a list its a real pain for the user. > > heres a screen shot. > http://www.treshna.com/~andru/gtkcomboentry.png > > Does anyone know of a way I can force highlighting in GtkComboBox? Is it > possible to extract the table_view variable > from the GtkCombo? Maybe that would allow me to force selection of the > cell i want. I'm just not sure on the > approach to solving this. If someone knows of an app that uses > GtkComboBoxEntry effectivily let me know, maybe > that code could help me out a bit.
This example shows the behaviour you're looking for - not exactly but it's close - with no need for an special configuration. It always shows the selected item centered on the combo, just using gtk_combo_box_new_text() on the combo box construction. May be it could help you. // save as test.c. // compile with: // gcc `pkg-config --cflags --libs gtk+-2.0` test.c -o test #include <gtk/gtk.h> int main (int argc, char **argv) { GtkWidget *window; GtkWidget *vbox; GtkWidget *combo; gtk_init (&argc, &argv); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); vbox = gtk_vbox_new (FALSE, 0); gtk_widget_show (vbox); gtk_container_add (GTK_CONTAINER (window), vbox); combo = gtk_combo_box_new_text (); gtk_widget_show (combo); gtk_box_pack_start (GTK_BOX (vbox), combo, FALSE, FALSE, 0); // sorry for the long list but is needed when testing gtk_combo_box_append_text(GTK_COMBO_BOX(combo), "one"); gtk_combo_box_append_text(GTK_COMBO_BOX(combo), "two"); gtk_combo_box_append_text(GTK_COMBO_BOX(combo), "three"); gtk_combo_box_append_text(GTK_COMBO_BOX(combo), "four"); gtk_combo_box_append_text(GTK_COMBO_BOX(combo), "five"); gtk_combo_box_append_text(GTK_COMBO_BOX(combo), "six"); gtk_combo_box_append_text(GTK_COMBO_BOX(combo), "seven"); gtk_combo_box_append_text(GTK_COMBO_BOX(combo), "eight"); gtk_combo_box_append_text(GTK_COMBO_BOX(combo), "nine"); gtk_combo_box_append_text(GTK_COMBO_BOX(combo), "ten"); gtk_combo_box_append_text(GTK_COMBO_BOX(combo), "eleven"); gtk_combo_box_append_text(GTK_COMBO_BOX(combo), "twelve"); gtk_combo_box_append_text(GTK_COMBO_BOX(combo), "q"); gtk_combo_box_append_text(GTK_COMBO_BOX(combo), "w"); gtk_combo_box_append_text(GTK_COMBO_BOX(combo), "e"); gtk_combo_box_append_text(GTK_COMBO_BOX(combo), "r"); gtk_combo_box_append_text(GTK_COMBO_BOX(combo), "t"); gtk_combo_box_append_text(GTK_COMBO_BOX(combo), "y"); gtk_combo_box_append_text(GTK_COMBO_BOX(combo), "u"); gtk_combo_box_append_text(GTK_COMBO_BOX(combo), "i"); gtk_combo_box_append_text(GTK_COMBO_BOX(combo), "o"); gtk_combo_box_append_text(GTK_COMBO_BOX(combo), "p"); gtk_combo_box_append_text(GTK_COMBO_BOX(combo), "a"); gtk_combo_box_append_text(GTK_COMBO_BOX(combo), "s"); gtk_combo_box_append_text(GTK_COMBO_BOX(combo), "d"); gtk_combo_box_append_text(GTK_COMBO_BOX(combo), "f"); gtk_combo_box_append_text(GTK_COMBO_BOX(combo), "g"); gtk_combo_box_append_text(GTK_COMBO_BOX(combo), "h"); gtk_combo_box_append_text(GTK_COMBO_BOX(combo), "j"); gtk_combo_box_append_text(GTK_COMBO_BOX(combo), "k"); gtk_combo_box_append_text(GTK_COMBO_BOX(combo), "l"); gtk_combo_box_append_text(GTK_COMBO_BOX(combo), "z"); gtk_combo_box_append_text(GTK_COMBO_BOX(combo), "x"); gtk_combo_box_append_text(GTK_COMBO_BOX(combo), "c"); gtk_combo_box_append_text(GTK_COMBO_BOX(combo), "v"); gtk_combo_box_append_text(GTK_COMBO_BOX(combo), "b"); gtk_combo_box_append_text(GTK_COMBO_BOX(combo), "n"); gtk_combo_box_append_text(GTK_COMBO_BOX(combo), "m"); g_signal_connect ((gpointer) window, "destroy", G_CALLBACK (gtk_main_quit), NULL); gtk_widget_show (window); gtk_main (); return 0; } -- Iago Rubio _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list