Tk-HListbox
view release on metacpan or search on metacpan
lib/Tk/HListbox.pm view on Meta::CPAN
The Home and End keys scroll the listbox horizontally to
the left and right edges, respectively.
=item [10]
Control-Home sets the location cursor to the the first element in
the listbox, selects that element, and deselects everything else
in the listbox.
=item [11]
Control-End sets the location cursor to the the last element in
the listbox, selects that element, and deselects everything else
in the listbox.
=item [12]
In B<extended> mode, Control-Shift-Home extends the selection
to the first element in the listbox and Control-Shift-End extends
the selection to the last element.
=item [13]
In B<multiple> mode, Control-Shift-Home moves the location cursor
to the first element in the listbox and Control-Shift-End moves
the location cursor to the last element.
=item [14]
The space and Select keys toggle a selection at the location cursor
(active element) just as if mouse button 1 had been pressed over
this element.
=item [15]
In B<extended> mode, Control-Shift-space and Shift-Select
extend the selection to the active element just as if button 1
had been pressed with the Shift key down.
=item [16]
In B<extended> mode, the Escape key cancels the most recent
selection and restores all the elements in the selected range
to their previous selection state. NOTE: This may not be
fully working correctly.
=item [17]
Control-slash selects everything in the widget, except in
B<single> and B<browse> modes, in which case it selects
the active element and deselects everything else.
=item [18]
Control-backslash deselects everything in the widget, except in
B<browse> mode where it has no effect.
=item [19]
The F16 key (labelled Copy on many Sun workstations) or Meta-w
copies the selection in the widget to the clipboard, if there is
a selection.
=item [20]
We've added <Ctrl-<Prior>> and <Ctrl-<Next>> bindings
to scroll the listbox view up and down by one page while
selecting a page's worth of items.
=back
The behavior of HListboxes can be changed by defining new bindings for
individual widgets or by redefining the class bindings.
=head1 TIED INTERFACE
The Tk::HListbox widget can also be tied to a scalar or array variable, with
different behaviour depending on the variable type, with the following
tie commands:
use Tk;
my ( @array, $scalar, $other );
my %options = ( ReturnType => "index" );
my $MW = MainWindow->new();
my $lbox = $MW->HListbox()->pack();
my @list = ( "a", "b", "c", "d", "e", "f" );
$lbox->insert('end', @list );
tie @array, "Tk::HListbox", $lbox
tie $scalar, "Tk::HListbox", $lbox;
tie $other, "Tk::HListbox", $lbox, %options;
currently only one modifier is implemented, a 3 way flag for tied scalars
"ReturnType" which can have values "element", "index" or "both". The default
is "element".
=over
=item Tied Arrays
If you tie an array to the HListbox you can manipulate the items currently
contained by the box in the same manner as a normal array, e.g.
print @array;
push(@array, @list);
my $popped = pop(@array);
my $shifted = shift(@array);
unshift(@array, @list);
delete $array[$index];
print $string if exists $array[$i];
@array = ();
splice @array, $offset, $length, @list
The delete function is implemented slightly differently from the standard
array implementation. Instead of setting the element at that index to undef
it instead physically removes it from the HListbox. This has the effect of
changing the array indices, so for instance if you had a list on non-continuous
indices you wish to remove from the HListbox you should reverse sort the list
( run in 1.348 second using v1.01-cache-2.11-cpan-84e82930d8c )