This change to the code creating the Tk::HList widget will cause a changing, pipe ('|') separated, list of paths to appear in the Tk::Label as you move the mouse and highlight different parts of the tree.
my $hlist; $hlist = $app_F->HList( -itemtype => 'text', -selectmode => 'extended', -browsecmd => sub { $label_text = join '|' => $hlist->selectionGet + }, );
The (possibly) odd-looking "my $hlist; $hlist = ..." is intended: $hlist is used in the -browsecmd callback, so it needs to be declared before the widget is created and assigned to that variable. There's no syntactical reason for putting the separate declaration and assignment on the same line: use whatever style suits you.
As before, process the array returned by $hlist->selectionGet however you want. Also, see the Tk::HList documentation for how this behaves differently in scalar context.
-- Ken
In reply to Re^3: How to bind single click to get an path of an entry in Tk::HList
by kcott
in thread How to bind single click to get an path of an entry in Tk::HList
by rjohn1
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |