i've started to write a small GUI with GTK. A lot of thinks work fine, but I have one problem: I want to have a list - like the email list at the usual mail client. Tutorials told me, that I have to use TreeView.
I created an instance of ListStore and added a row. I see the row, and I'm able to click on the row (the row change the color) but i don't see any text in the cells. Does anyone have an idea how to fix it?
Thanks and bye,
Patrick
here is my code:
list_store = Gtk::ListStore.new(String, String, String)
iter = list_store.append
I created an instance of ListStore and added a row. I see the row, and
I'm able to click on the row (the row change the color) but i don't see
any text in the cells. Does anyone have an idea how to fix it?
This is the easy way to affect the content of a column to the data stored in
the model. The last argument of the TreeViewColumn constructor is a hash of
attributes which define a mapping between the data in the model, and what
will appear in the TreeView (those attributes can be reaffected later with #add_attribute or #set_attributes)
The attribute {:text => 0} means "I want to map directly the content of
iter[0] to the rendered text of the "Foo" column".
Another way to do this is by using the #set_cell_data_func method, which let
you define the rendering of the cell from the given block (using
CellRenderer#text=, for example)