Re: TreeModelColumn



On Saturday 22 October 2005 00:38, Marcelo David wrote:
> Hi,
>
> I want to create a dinamic TreeView, then I dont know how many columns I'll
> have.
>
> I need another way for get and set values to the columns where I can to
> reference a column with an index value (or number of column). In another
> words I need to declarate TreeModelColumns to ColumnRecord at runtime and
> I'll have an index to referenciate to columns for get and set methods.

You have to know the number of tree model columns (storage data points) when 
creating the tree model (and the type of each tree model column).  In your 
case the tree model columns could represent the maximum number of columns you 
might want to display.  You connect the Gtk::TreeModel columns to the 
Gtk::TreeView columns dynamically anyway, with 
Gtk::TreeView::append_column(), so just don't connect up the tree model 
columns you don't want displayed (they will then be hidden).

Tree models are just structured data points, which you can display with a tree 
view.  You don't in fact have to display any or all of the tree model columns 
if you choose not to do so.  If you think of them that way then it should be 
reasonably straightforward.

Incidentally you can sort on a hidden tree model column - that is quite a 
common use of them.

Chris




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