Bernard Fouché wrote:
I'm now building a list of choices in a
GtkComboxEntry widget. These choices are calculated on the fly.
If I call clear() before inserting text entries, the list stays empty,
even if calls to insert_text() are done. I don't know how I can count
entries, hence I use the value '50' for manual clearing with
remove_text(), something I don't like ('50' is totally arbitrary).
What did I miss this time?
In order to hide the complexities of using some of the widgets, php-gtk sometimes provide certain convenience methods to make it easier to use. In the case of GtkComboBox, these methods include append_text() , prepend_text() , insert_text() and remove_text().
However, when you want to do more advanced stuff, such as changing the options on-the-fly, you need to access its underlying model directly.
A GtkComboBox is just like a GtkTreeView. It adopts the data-view model. The data is stored is a data model (e.g. GtkListStore), and the associating view displays the data.
The following example shows the basic setup using the data-view model for combobox:
http://www.kksou.com/php-gtk2/articles/setup-and-process-GtkComboBox.phpAnd the following example expands on the above example to show how to change the options on the fly:
http://www.kksou.com/php-gtk2/articles/change-options-of-pulldown-menu-on-the-fly-using-GtkComboBox.phpRegards,
/kksou