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 / notebook.pl
CommitLineData
86530b38
AT
1# Notebook, selectable pages.
2
3use Tk;
4use Tk::DialogBox;
5use Tk::NoteBook;
6use Tk::LabEntry;
7
8my $name = "Rajappa Iyer";
9my $email = "rsi\@netcom.com";
10my $os = "Linux";
11
12use vars qw($top);
13
14$top = MainWindow->new;
15my $pb = $top->Button(-text => "Notebook", -command => \&donotebook);
16$pb->pack;
17MainLoop;
18
19
20my $f;
21
22sub donotebook {
23 if (not defined $f) {
24 # The current example uses a DialogBox, but you could just
25 # as easily not use one... replace the following by
26 # $n = $top->NoteBook(-ipadx => 6, -ipady => 6);
27 # Of course, then you'd have to take care of the OK and Cancel
28 # buttons yourself. :-)
29 $f = $top->DialogBox(-title => "Personal Profile",
30 -buttons => ["OK", "Cancel"]);
31 my $n = $f->add('NoteBook', -ipadx => 6, -ipady => 6);
32
33 my $address_p = $n->add("address", -label => "Address", -underline => 0);
34 my $pref_p = $n->add("pref", -label => "Preferences", -underline => 0);
35
36 $address_p->LabEntry(-label => "Name: ",
37 -labelPack => [-side => "left", -anchor => "w"],
38 -width => 20,
39 -textvariable => \$name)->pack(-side => "top", -anchor => "nw");
40 $address_p->LabEntry(-label => "Email Address:",
41 -labelPack => [-side => "left", -anchor => "w"],
42 -width => 50,
43 -textvariable => \$email)->pack(-side => "top", -anchor => "nw");
44 $pref_p->LabEntry(-label => "Operating System:",
45 -labelPack => [-side => "left"],
46 -width => 15,
47 -textvariable => \$os)->pack(-side => "top", -anchor => "nw");
48 $n->pack(-expand => "yes",
49 -fill => "both",
50 -padx => 5, -pady => 5,
51 -side => "top");
52
53 }
54 my $result = $f->Show;
55 if ($result =~ /OK/) {
56 print "name = $name, email = $email, os = $os\n";
57 }
58}
59