Re: populating a TreeStore in reverse order



On Wed, 2005-06-22 at 11:49 +0200, The Saltydog wrote:
I need to populate a TreeStore from a flow of data coming from a pipe.
Each line of data will also have an associated "depth" value so that I
can understand the depth in the tree.

Populating the TreeStore would not be a problem, but the data is
arriving in the pipe in reverse-order. Can I populate a TreeStore
starting from the bottom? I had a look at documentation, but it seems
not to be possible..

You can, using 'prepend' instead of 'append', but you can't change the
depth of a row, and the parents must already exist.
One way would be to create empty parents so you can put the row at the
desired depth, and then fill the parents with the real data when you get
there.

A _much_ more complex way, would be to keep the data in a perl array,
and use a custom store. But you have to tell the store when you
change/add/remove a row in the perl array. Scrolling would be slower,
but the initial filling would be faster (with fixed height rows).
I did it with a list, I'm not sure how much more difficult/slower it
would be with a tree.





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