Re: GtkTreeView with huge amount of rows; dynamic data source?



Dnia 13-01-2005, czw o godzinie 10:46 -0600, Greg Breland napisał:
I don't think there is a simple way to determine how many rows a

(just to nitpick, it's TreeView doing display, not liststore)

liststore is displaying, but this can be solved by populating more rows
than you need.  So figure that the typical row is 20 pixels high, on a
2000x2000 screen that would be 100 rows.  So take the top row position
and make sure that the list store is populated for 200 rows below that. 
Not an ideal solution, but a reasonable workaround.  Even better would
be to base your calculation on the actual size of the TreeView control
to be more efficient.

One possible (if slightly hacky) solution I see here is to implement
dummy cellrenderer (let's call it FetchRenderer) whose only purpose
would be to mark currently displayed rows (ie, when your FetchRenderer
is asked to render(), all it does is fetch appropriate rows from
database). There may be some slight issues with this approach, namely
it'll probably need to occupy additional 1x1 area (non-issue in
reality), and more importantly, I don't know of any guarantees about
order in which renderers are activated inside TreeView, so it might
generate some flicker (as in, when TextRenderer is activated first, sees
only empty button, does size nego and rendering based on that, and then
your FetchRenderer triggers database fetch, causing TextRenderer to
re-nego and rerender), but you need to see in practice if that's real
issue.

HTH,
Maciej

-- 
Maciej Katafiasz <ml mathrick org>




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