Tk::EntrySet - display/edit a list of values in a Set of Widgets. |
Tk::EntrySet - display/edit a list of values in a Set of Widgets.
require Tk::EntrySet;
my $valuelist = []; my $instance = $main_window->EntrySet()->pack; $instance->configure(-valuelist_variable => \$valuelist); $instance->valuelist([qw/foo bar baz/]);
Tk::EntrySet creates a Set of widgets to display/edit a list of values. The widget class is configurable. Tk::EntrySet adds/removes widgets to match the size of the valuelist. If a user deletes an entrywidgets content, the value is deleted from the valuelist and the entry is removed from the set on view update. View updates are by default bound to <Return> events. 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. Tk::EntrySet is a Tk::Frame derived widget.
Tk::EntrySet supports the following methods:
Tk::EntrySet supports the following options:
insert('end',$_[1])
}, which is suitable for Tk::Entry.
use strict; use warnings;
use Tk;
my $mw = MainWindow->new ; require Tk::EntrySet;
my $valuelist = []; my $entryset = $mw->EntrySet()->pack; $entryset->configure(-valuelist_variable => \$valuelist); $entryset->valuelist([qw/foo bar baz/]);
# use another entryclass:
my $num_set = $mw->EntrySet(-entryclass => 'NumEntry')->pack; $num_set->valuelist([3,15,42]);
# use a BrowseEntry with custom get/set/callback_installer:
my $getter = sub{ $_[0]->Subwidget('entry')->get}; my $setter = sub{my $e = $_[0]->Subwidget('entry'); $e->delete(0,'end'); $e->insert('end', $_[1]); }; my $inst = sub{$_[0]->bind('<Key-Return>' ,$_[1]); $_[0]->configure(-browsecmd => $_[1]); }; my $mbe = $mw->EntrySet(-entryclass => 'BrowseEntry', -entryoptions => [-choices => [qw/ a b c d /]], -getter => $getter, -setter => $setter, -callback_installer => $inst, )->pack(-fill => 'both', -expand => 1); $mbe->valuelist([qw/a c/]);
MainLoop;
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::EntrySet - display/edit a list of values in a Set of Widgets. |