|
From: Joe E. <jen...@fl...> - 2006-09-16 19:25:32
|
Recently, Pat added an "identify" method to all Tile widgets
that previously lacked one. Usage is: [$w identify $x $y],
which returns the name of the element at $x,$y. This is useful
in conjunction with custom layouts for creating certain types
of megawidgets: class bindings can do different things depending
on which element was pressed.
There are a couple exceptions, though -- the ttk::treeview
and ttk::paned widgets already had 'identify' methods
with a different return value.
For [ttk::paned], the 'identify' method returns a two-element
list containing the index of the sash at $x,$y followed by
the name of the sash element. (At least that's how it's
documented -- in reality the element name lookup is
Not Yet Implemented. This would be useful for e.g.,
sashes with "collapse" and "expand" buttons.)
For [ttk::treeview], the 'identify' method is a hairball
and needs to be revised anyway.
The ttk::notebook widget currently uses the generic
'identify' method implementation. This is not as useful
as it could be, since it only examines the notebook's base
layout and what you're generally interested in is the tabs.
See SF#1458239 for primary use case ("close" buttons in tabs).
So my question: should the ttk::notebook 'identify' method
be changed to work like the ttk::paned widget (how it's
documented, that is, not how it's currently implemented)?
Or is it worthwhile to make [$w identify] consistent across
all widget classes like 'configure', 'cget', and 'state' are?
(With the latter solution, [$w identify] would return
the tab/sash or base layout element, and the tab/sash index
could be identified with a different method).
I'm leaning towards the former approach.
--Joe English
|