Optionmenu - Online Linux Manual PageSection : 3pm
Updated : 2020-11-09
Source : perl v5.32.0
Note : User Contributed Perl Documentation

NAMETk::Optionmenu − Let the user select one of some predefined options values

SYNOPSIS​ use 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.

EXAMPLE​ use 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, "\n" }, ​ −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
0
Johanes Gumabo
Data Size   :   9,074 byte
man-Tk::Optionmenu.3pmBuild   :   2024-12-05, 20:55   :  
Visitor Screen   :   x
Visitor Counter ( page / site )   :   2 / 200,509
Visitor ID   :     :  
Visitor IP   :   13.59.69.109   :  
Visitor Provider   :   AMAZON-02   :  
Provider Position ( lat x lon )   :   39.962500 x -83.006100   :   x
Provider Accuracy Radius ( km )   :   1000   :  
Provider City   :   Columbus   :  
Provider Province   :   Ohio ,   :   ,
Provider Country   :   United States   :  
Provider Continent   :   North America   :  
Visitor Recorder   :   Version   :  
Visitor Recorder   :   Library   :  
Online Linux Manual Page   :   Version   :   Online Linux Manual Page - Fedora.40 - march=x86-64 - mtune=generic - 24.12.05
Online Linux Manual Page   :   Library   :   lib_c - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Online Linux Manual Page   :   Library   :   lib_m - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Data Base   :   Version   :   Online Linux Manual Page Database - 24.04.13 - march=x86-64 - mtune=generic - fedora-38
Data Base   :   Library   :   lib_c - 23.02.07 - march=x86-64 - mtune=generic - fedora.36

Very long time ago, I have the best tutor, Wenzel Svojanovsky . If someone knows the email address of Wenzel Svojanovsky , please send an email to johanes_gumabo@yahoo.co.id .
If error, please print screen and send to johanes_gumabo@yahoo.co.id
Under development. Support me via PayPal.

ERROR : Need New Coding :         (parse_manual_page_|249|Tk::Optionmenu.3pm|36/37|el══─{─══.|.el══─{─══. ds -- \|\(em\| )         (htmlprn|149|Tk::Optionmenu.3pm|36/37|.el══─{─══. ds --  —  |.el══─{─══. ds -- \|\(em\| )         (parse_manual_page_|249|Tk::Optionmenu.3pm|43|br══─}─══|'br══─}─══ )         (htmlprn|149|Tk::Optionmenu.3pm|43|'br══─}─══ |'br══─}─══ )