Re: TreeView: Multiple selection inefficient?



On Sat, 2005-04-09 at 21:59 +0200, mkay wrote:
> If one or more rows are selected, a signal_selection_changed signal is 
> emitted.  In the signal handler, another callback function is called for 
> every row that is selected.  This happens internally, I only have to 
> call selected_foreach_iter with a functor (a sigc::slot) to which the 
> callback function is bound.
[snip]
> Consider a TreeView with 1000 entries.  Now select the first entry, hold 
> shift and press the down-key to expand the selection downwards till you 
> reach the bottom.
> After hitting 'down' for the n-th time, the signal handler has been 
> called (n * (n+1)) / 2 times (1 + 2 + 3 + ... + n).

You don't have to call foreach() on each row. But if you really want to
examine each selection whenever the selection changes, what's the
alternative?

Hopefully you more often want to just know the first and last selected
rows, or if anything is selected at all. Then you wouldn't have to call
foreach() on them all.

-- 
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]