Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | |
2 | ||
3 | sub mkForm { | |
4 | ||
5 | # Create a top-level window that displays a bunch of entries with tabs set up to move between them. | |
6 | ||
7 | $mkForm->destroy if Exists($mkForm); | |
8 | $mkForm = $top->Toplevel(); | |
9 | my $w = $mkForm; | |
10 | dpos $w; | |
11 | my(@pl) = (-side => 'top', -fill => 'x'); # packing list | |
12 | my(@ll) = ('Name:', 'Address:', '', '', 'Phone:'); # label list | |
13 | $w->title('Form Demonstration'); | |
14 | $w->iconname('Form'); | |
15 | my $w_msg = $w->Label(-font => '-Adobe-times-medium-r-normal--*-180-*-*-*-*-*-*', -wraplength => '4i', | |
16 | -justify => 'left', -text => 'This window contains a simple form where you can type in the ' . | |
17 | 'various entries and use tabs to move circularly between the entries. Click the "OK" button ' . | |
18 | 'or type return when you\'re done.'); | |
19 | $w_msg->pack(@pl); | |
20 | my $i = 1; | |
21 | while ($i <= 5) { | |
22 | my $f = $w->Frame(-bd => '1m'); | |
23 | my $e = $f->Entry(-relief => 'sunken', -width => '40'); | |
24 | my $l = $f->Label(-text => $ll[$i-1]); | |
25 | $e->bind('<Return>', ['destroy', $w]); | |
26 | $f->pack(@pl); | |
27 | $e->pack(-side => 'right'); | |
28 | $l->pack(-side => 'left'); | |
29 | $i++; | |
30 | } | |
31 | my $w_ok = $w->Button(-text => 'OK', -width => 8, -command => ['destroy', $w]); | |
32 | $w_ok->pack(-side => 'top'); | |
33 | ||
34 | } # end mkForm | |
35 | ||
36 | ||
37 | 1; |