Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | # form.pl |
2 | ||
3 | use vars qw/$TOP/; | |
4 | ||
5 | sub form { | |
6 | ||
7 | # Create a top-level window that displays a bunch of entries with | |
8 | # tabs set up to move between them. | |
9 | ||
10 | my($demo) = @_; | |
11 | $TOP = $MW->WidgetDemo( | |
12 | -name => $demo, | |
13 | -text => 'This window contains a simple form where you can type in the various entries and use tabs to move circularly between the entries.', | |
14 | -title => 'Form Demonstration', | |
15 | -iconname => 'form', | |
16 | ); | |
17 | my $f = $TOP->Frame->pack(-fill => 'both'); | |
18 | my $row = 0; | |
19 | foreach ('Name:', 'Address:', '', '', 'Phone:') { | |
20 | my $e = $f->Entry(qw/-relief sunken -width 40/); | |
21 | my $l = $f->Label(-text => $_, -anchor => 'e', -justify => 'right'); | |
22 | Tk::grid( $l, -row => $row, -column => 0, -sticky => 'e'); | |
23 | Tk::grid( $e, -row => $row++, -column => 1,-sticky => 'ew'); | |
24 | $f->gridRowconfigure(1,-weight => 1); | |
25 | $e->focus if $_ eq 'Name:'; | |
26 | } | |
27 | $TOP->bind('<Return>' => [$TOP => 'destroy']); | |
28 | ||
29 | } # end form | |
30 | ||
31 | 1; |