The New PerlTk.org - Specifying a Default Optionmenu Selection
www.mamboteam.com
The New PerlTk.org  
Home
Wednesday, 23 July 2014
 
 
Main Menu
Home
Perl/Tk Widgets
Articles
Scripts
Useful Tips
Links
Contact Us
Search
FAQs
Login Form
Username

Password

Remember me
Forgotten your password?
No account yet? Create one
Specifying a Default Optionmenu Selection PDF Print E-mail
User Rating: / 27
PoorBest 
Written by Ala Qumsieh   
There are 2 ways to specify a default Optionmenu selection:
  1. 1. Order the array reference that you pass to -options such that the first element is your default one.
  2. 2. Use the undocumented -textvariable option, instead of -variable, and set it to the default value you want:
        my @values = 1 .. 10;
        my $value  = 5;
        my $menu   = $mw->Optionmenu( -options      => \@values,
                                      -textvariable => \$value )->pack();
    
    Write Comment (2 Comments)
< Prev
 
Top! Top!