Re: Virtual list boxes (using GtkTreeView or other)



On 6/1/07, David Nečas (Yeti) <yeti physics muni cz> wrote:
On Fri, Jun 01, 2007 at 03:47:36PM +0100, Nuno Lucas wrote:
> >
> > You have to derive your own GtkTreeModel, if the predefined GtkListStore
> > or GtkTreeStore are not sufficient (They simply stores all data at once).
>
> I may be missing something, but I don't see a way to set the number of
> "virtual" rows.

See http://gwyddion.net/documentation/head/libgwydgets/GwyNullStore.php
for a simple purely virtual store.  This is a cheap hack,
but it demonstrates the point IMO.

Thanks! That is exactly the kind of sample I needed to look at!

> From what I see in the documentation, the only way to grow is by
> appending a single row at a time (which I guess then emits the
> "row-changed" signal and updates the scrollbar).

You are mixing two things here:
- if the model grows is must emit the row-inserted signal,
  because if it does not do this, the tree views showing it
  break
- however, if no one is watching, namely when the model is
  created, it can be instantaneously created with a million
  of rows

I see. Now I understand. I only need to implement my own "store"
and make sure I only call gtk_tree_set_model() after I set the
number of rows I want.

There are more troubles with huge tree views, namely the
tree view needs to know the sizes of the columns and rows --
even those not currently visible as they still affect what
is visible.  So you will probably end up using all the
confusing fixed size modes, and avoiding work in cell data
functions for invisible cells.

I am aware of this kind of problems and am expecting them.

However, for a milion of rows scrolling through the tree
manually is no longer useful anyway, i.e. the user interface
ceases to be suitable for the task.  You may want to use
a multilevel or search+paging base interface instead --
essentially something that avoids the signle list with
a million of rows by design.

I agree, but that's what the boss wants ;-)

On the other hand, as I'm using a generic tree view to show a list, I
could use that property to show a next and previous page controls (as
"owner drawn" root columns) and restrict the ouput to some row limit.

Yeti

Thank you, you were most helpful.

Best regards,
~Nuno Lucas


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