summaryrefslogtreecommitdiff
path: root/Master/tlpkg/tlperl/lib/Tk/demos/widget_lib/browseentry.pl
blob: ce32f13934b888a4bd3ebda906c982ca2618ea05 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# BrowseEntry, entry with listbox to select list values.

use Tk::BrowseEntry;

my $month = "January";

outer:
{
    my $top = MainWindow->new;
    my $f = $top->Frame;
    my $c = $f->BrowseEntry(-label => "Month:", -variable => \$month);
    $c->pack;
    $c->insert("end", "January");
    $c->insert("end", "February");
    $c->insert("end", "March");
    $c->insert("end", "April");
    $c->insert("end", "May");
    $c->insert("end", "June");
    $c->insert("end", "July");
    $c->insert("end", "August");
    $c->insert("end", "September");
    $c->insert("end", "October");
    $c->insert("end", "November");
    $c->insert("end", "December");
    my $bf = $f->Frame;
    $bf->Button(-text => "Print value",
		-command => sub {
		    print "The month is $month\n";
		}, -relief => "raised")->pack;

    $bf->pack;
    $f->pack;
    MainLoop;
}