I've a question about working with a Scrolled Tree in Perl/Tk. I want
to detect if an entry of the tree is visible in the window (i.e after
opening the indicator) ?
TIA
Pit
The following two HList methods may produce the data you need.
*$hlist*->info(anchor)
Returns the entryPath of the current anchor, if any, of the
HList widget. If the anchor is not set, returns the empty
string.
*$hlist*->infoBbox(*$entryPath*)
Returns a list of four numbers describing the visible
bounding box of the entry given *$entryPath*. The first two
elements of the list give the x and y coordinates of the
upper-left corner of the screen area covered by the entry
(specified in pixels relative to the widget) and the last
two elements give the lower-right corner of the area, in
pixels. If no part of the entry given by index is visible on
the screen then the result is an empty string; if the entry
is partially visible, the result gives the only the visible
area of the entry.
Something like (untested):
my @allEntryPaths = $treeWidget->info();
foreach my $entryPath (@allEntryPaths) {
my @entryIsVisible = $treeWidget->infoBbox($entryPath);
if ($entryIsVisible[0]) {
#entry is visible, the list should contain $x1,$y1,$x2,$y2
}
}
hth,
Jason