Re: Selections in TreeViewS and efficiency issues

Murray Cumming wrote:
On Sat, 2005-04-09 at 18:56 +0200, Matthias Kaeppler wrote:

Matthias Kaeppler wrote:

1. How can I avoid this seemingly inefficient behavior? How can I keep it from reiterating over all rows again, if I add more items to the selection?

Looks like I'm the only one who's bothered by this.
Okay, look again:

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). That means, after selecting 1000 entries this way, the signal handler has been called (1000 * 1001)/2 times, that is 500500 times. In words: Over half a /million/ times!

This is more appropriate for gtk-list gnome org  They would probably
like a real example rather than a theory.

Well, I'm using gtkmm and the libsig++ callbacks. I have no idea if this will apply to Gtk+ programs written in C.
Or are the gtkmm developers in that mailing list, too?

If you need an example, I can send you the source code of my widget, it's not much. Just set a counter in the selected_foreach_iter callback and you'll see.

Matthias Kaeppler

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