Re: how to add a column to a GtkListStore

On Tue, 2004-12-14 at 21:44 +0100, edward hage wrote:


I have an application in which I have a GtkListStore with a variable amount of rows. If I 
create a new element in my app than I also want to create a new row which shows the new data.

Now I create a new row by creating a new model with gtk_list_store_new(1, G_TYPE_DOUBLE) 
and than place that model in a gtk_hbox next to its brothers. This looks like a single 
table with more columns, but in fact it is just a couple of single list_stores packed 
together.  This approach works, but my question is if it is possible to do this more simple?

Unless I understand your situation wrong, this is not the way to do it,
you should be using gtk_list_store_append () and gtk_list_store_prepend
() to add rows.

I could not find a gtk_tree_store_append_column which would be nice. Is it possible to 
make adding a column as easy as adding a row? Does anybody have a smart way to accomplish 

The general idea is, you have a GtkListStore or a GtkTreeStore and put
your data in there.  Using that, you then use something like
gtk_cell_renderer_text_new () with
gtk_tree_view_insert_column_with_attributes () and set up which data you
want to show in your columns.

I suggest looking at the tutorials and reading up the on the


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