Re: GtkComboBox - how to clear and repopulate in one step?



You may create the combo box using gtk_combo_box_new_with_model.
You insert all the items that may appear in the second combo box in a
GtkListStore. Along with the text, you create a column that contains the
index of
the items in the first combo box that they belong to. Use a
GtkTreeModelFilter
over the GtkListStore and define a visibility function that returns true for
the rows whose index column value is equal with the selected index of
the first combo box. Now, every time when the index in the first combo box
changes, you just have to call gtk_tree_model_filter_refilter.

Other solution is to use gtk_combo_box_new_with_model using a GtkListStore.
When the selection in the first combo box changes, you call
gtk_list_store_clear.



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