Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / tools / perl-5.8.0 / lib / site_perl / 5.8.0 / sun4-solaris / Tk / demos / widtrib / browseentry2.pl
CommitLineData
86530b38
AT
1# BrowseEntry, another example.
2#
3# Chris Dean <ctdean@cogit.com>
4
5use strict;
6use Tk;
7use Tk::BrowseEntry;
8
9my $top = new MainWindow( -title => "BrowseEntry 2" );
10main( $top );
11MainLoop();
12
13sub main {
14 my( $top ) = @_;
15
16 my @countries = qw( America Belize Canada Denmark Egypt Fruitopia );
17 my @states = qw( normal readonly disabled );
18 foreach my $i (0..$#states) {
19 my $state = $states[$i];
20 my $var = $countries[$i];
21 my $f = $top->Frame->pack( qw/-side left/ );
22 my $be = $f->BrowseEntry( -variable => \$var,
23 -choices => \@countries,
24 -state => $state )->pack;
25 if( $state eq "disabled" ) {
26 $be->configure( -arrowimage => $f->Getimage( "balArrow" ) )
27 }
28 foreach my $s (@states) {
29 $f->Radiobutton( -text => $s,
30 -value => $s,
31 -variable => \$state,
32 -command => sub {
33 $be->configure( -state => $state ); }
34 )->pack( qw/-anchor w/ );
35 }
36 $f->Button( -text => "Print value", -command => sub {
37 print "$var\n" } )->pack;
38 }
39}