From: Peter J. <pe...@pe...> - 2007-03-13 17:10:28
|
On Tue, Mar 13, 2007 at 05:55:56PM +0100, Vladimir Fekete wrote: > Hi all! > > I have following problem : I'm using gtk2 and I want to write an > application wich, after start loads strings which should be in some > ComboBoxEntry from external file and in the end saves them back to same > file (similar behaviour as URL history in browser). > > Problem is that I don't know how to get list of strings stored in > ComboBox (Gtk::ComboBoxEntry.new(true)). According to reference manual, > there are onle Gtk::ComboBox#append_text, Gtk::ComboBox#insert_text, > Gtk::ComboBox#prepend_text, Gtk::ComboBox#remove_text and > Gtk::ComboBox#active_text methods supported. Unfortunately, there's no API for that when using Gtk::ComboBox in the "convenience mode" with just strings. You'll have to iterate over the underlying Gtk::TreeModel to get all the strings: list = [] combo_box.model.each { |model, path, iter| list << model.get_value(iter, 0) } (Should work in theory, haven't tested here) -pete |