Tk::ChoicesSet - display/edit a list of choices in a Set of single-selection Widgets. |
Tk::ChoicesSet - display/edit a list of choices in a Set of single-selection Widgets.
require Tk::ChoicesSet; my $labels_and_values = [ {label => 'foo', value => 1}, {label => 'bar', value => 2}, {label => 'baz', value => 3}, ]; my $instance = $main_window->ChoicesSet(-labels_and_values => $labels_and_values)->pack; $instance->configure(-valuelist_variable => \$valuelist); $instance->valuelist([1,3]);
Tk::ChoicesSet creates a Set of widgets to display/edit a list of choices. Each widget allows for a single selection out of a given list of options. The widget class is configurable. Per default Tk::ChoicesSet uses Tk::MatchingBE which is included in the Tk-EntrySet package. This can be changed to any widget that supports index based access to the selection. Tk::ChoicesSet adds/removes widgets to match the size of the valuelist. When a selection-widgets state becomes undef (deselected), the value is deleted from the valuelist and the widget is removed from the set on view update. View updates are by default bound to the widgets -selectcmd for integration with MatchingBE. This is configurable through the -callback_installer option. The last widget in the Set is always empty to allow users to append values to the list. (If you need editable values with an optionlist for 'suggestions' and value based access to the widgets in the set, you might want to use Tk::EntrySet.) Tk::ChoicesSet handles label/value pairs or simple choices lists. Tk::ChoicesSet is a Tk::EntrySet derived widget.
Tk::ChoicesSet supports the following methods:
Tk::ChoicesSet supports the following options:
set_selected_index($_[1])
}, which is suitable for Tk::MatchingBE.
See the examples/ subdirectory.
Christoph Lamprecht, ch.l.ngre@online.de
Copyright (C) 2008 by Christoph Lamprecht
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.7 or, at your option, any later version of Perl 5 you may have available.
Tk::ChoicesSet - display/edit a list of choices in a Set of single-selection Widgets. |