Query: tk::optionmenu
OS: suse
Section: 3
Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar
Optionmenu(3) User Contributed Perl Documentation Optionmenu(3)NAMETk::Optionmenu - Let the user select one of some predefined options valuesSYNOPSISuse Tk::Optionmenu; $opt = $w->Optionmenu( -options => REFERENCE_to_OPTIONLIST, -command => CALLBACK, -variable => SCALAR_REF, ); $opt->addOptions( OPTIONLIST ); # OPTION LIST is # a) $val1, $val2, $val3,... # b) [ $lab1=>$val1], [$lab2=>val2], ... ] # c) combination of a) and b), e.g., # val1, [$lab2=>val2], val3, val4, [...], ...DESCRIPTIONThe Optionmenu widget allows the user chose between a given set of options. If the user should be able to change the available option have a look at Tk::BrowseEntry.OPTIONS-options (Re)sets the list of options presented. -command Defines the callback that is invokes when a new option is selected. -variable Reference to a scalar that contains the current value of the selected option. -textvariable Reference to a scalar that contains the text label of the current value of the selected option.METHODSaddOptions Adds OPTION_LIST to the already available options.EXAMPLEuse Tk; my $mw = MainWindow->new(); my ($var, $tvar); my $opt = $mw->Optionmenu( -options => [[jan=>1], [feb=>2], [mar=>3], [apr=>4]], -command => sub { print "got: ", shift, " " }, -variable => $var, -textvariable => $tvar )->pack; $opt->addOptions([may=>5],[jun=>6],[jul=>7],[aug=>8]); my $f = $mw->Frame(-relief=>'groove', -borderwidth => 2)->pack; $f->Label(-textvariable=>$tvar)->pack(-side => 'left'); $f->Label(-text => " -> ")->pack(-side => 'left'); $f->Label(-textvariable=>$var)->pack(-side => 'left'); $mw->Button(-text=>'Exit', -command=>sub{$mw->destroy})->pack; MainLoop;SEE ALSOTk::Menubutton, Tk::BrowseEntry perl v5.12.1 2007-05-05 Optionmenu(3)
Related Man Pages |
---|
label(n) - mojave |
label(n) - suse |
label(3) - suse |
tk::userguide(3) - suse |
tk::labframe(3pm) - debian |
Similar Topics in the Unix Linux Community |
---|
What happened with AWK? |
Replacing a string with new line |
Getting values in pattern /val1/val2/val3/... |
awk data subsets manipulation |
Calculate the total 4 field based on the conditions |