Re: Adding Columns to Gtk::TreeView



> Hi,
> I'm into trouble again.
>
> Gtk::ListStore has to be initialized with Gtk::TreeModelColumnRecord.
> (hence
> the number of columns should be specified at compile time itself), using
> Gtk::ListStore::create() function
>
> how can i initialize gtk::liststore with out any column information. (the
> default constructor is protected).

I think you should initialize Gtk::ListStore with column information that
you build at runtime, using new to instantiate appropriate
Gtk::TreeModelColumn<>s at runtime.

And every time you want to change the column types or number of columns,
you create a new Gtk::ListStore, because it's obviously a new model for a
new set of data.

Google found an old email of mine talking about the same thing, with a
link to some ugly code of mine:
http://www.mail-archive.com/gtkmm-list gnome org/msg03588.html

> consider 2 cases.
>
> 1. I've to add n number of columns but every column is of type string
> only,
> in that case, i can initialize some m columns all of type string (m is a
> huge number), But if i accidentally add m+1 th column, then i'm in soup.
>
> 2. If the n columns are of different types, then i cannot initialize the
> list store with some m columns.


Murray Cumming
murrayc murrayc com
www.murrayc.com
www.openismus.com




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