RE: [gtkmm] Modifying a ListStore at runtime?



> All the examples of using a Gtk::ListStore used a derived 
> Gtk::TreeModel::ColumnRecord which adds member variables as 
> columns using its add() method.
> 
> Is it possible to do this as run-time, when you don't know 
> how many columns you need?

Yes, I do this in glom.

>  I know I will have an integer 
> column, followed by 1 or many Glib::ustring columns.  I guess 
> I could do something like:
> 
> int integer;
> Glib::ustring string;
> Gtk::TreeModel::ColumnRecord list_columns; 
> list_columns.add(integer); for (int i = 0; i < string_cols; ++i)
>   list_columns.add(string);
> 
> If this works, how should I reference the different string 
> columns, since all are using "string".

By column number. Everything that can take a ModelColumn should have an
overload that takes a column number. I think I added some of these to gtkmm
2.4, but I did not need them in glom, which uses gtkmm 2.2.

Murray Cumming
www.murrayc.com
murrayc usa net



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