Bryan Oakley wrote:
> Joe English wrote:
> > A <<TreeviewSelect>> event is generated in all cases
> > (except for [$treeview selection]), even if the selection
> > hasn't actually changed (e.g., adding an item that was
> > already selected still generates the event).
>
> What's the advantage to generating the event when the selection command
> is called, versus only generating it when the selection changes? I'm not
> sure I see it, though I'm betting you've recently thought about this
> more than I have. All things being equal, I think I'd rather have it
> only be generated when the selection actually changes.
What I was thinking is, [$tree selection] is usually called
because of some user action (clicking on an item, navigating
with the arrow keys, etc.), and the <<TreeviewSelect>> binding
is more of a response to the user gesture than it is to the
selection changing.
Also, the listbox widget works this way: with -selectmode single,
clicking the currently-selected item generates a <<ListboxSelect>>
event, even though the selection doesn't change. (Conversely,
if the application calls [$l selection set] it *doesn't* generate
an event).
What you suggest makes sense though -- generate the event when
(and only when) the selection changes. I'll implement it that
way initially, we can change it later if warranted.
The widget will probably also need a -command or -browsecommand
callback option; applications can use that to respond to
user gestures. (The class bindings are getting fairly complicated
and [$tree identify] remains a hairball; the way it stands now
it won't be as easy for applications to define widget instance
bindings as it is with the Listbox, so the Treeview will
need to provide an easy way to do this.)
--Joe English
jen...@fl...
|