5
# Create a top-level window that displays a bunch of entries with scrollbars.
7
$mkEntry2->destroy if Exists($mkEntry2);
8
$mkEntry2 = $top->Toplevel();
11
$w->title('Entry Demonstration');
12
$w->iconname('Entries');
13
my $w_msg = $w->Label(-font => '-Adobe-times-medium-r-normal--*-180-*-*-*-*-*-*', -wraplength => '5i',
14
-justify => 'left', -text => 'Three different entries are displayed below, with a scrollbar for ' .
15
'each entry. You can add characters by pointing, clicking, and typing. You can delete by ' .
16
'selecting and typing Backspace, Delete, or Control-X. Backspace and Control-h erase the ' .
17
'character to the left of the insertion cursor, Delete and Control-d delete the chararacter ' .
18
'to the right of the insertion cursor, Control-W erases the word to the left of the insertion ' .
19
'cursor, and Meta-d deletes the word to the right of the insertion cursor. For entries that are ' .
20
'too large to fit in the window all at once, you can scan through the entries using the ' .
21
'scrollbars, or by dragging with mouse button 2 pressed. Click the "OK" button when you\'ve ' .
23
my $w_frame = $w->Frame(-borderwidth => '10');
24
my $w_ok = $w->Button(-text => 'OK', -width => 8, -command => ['destroy', $w]);
25
my (@pl) = (-side => 'top', -fill => 'both');
28
$w_ok->pack(-side => 'top');
30
my $w_frame_e1 = $w_frame->Entry(-relief => 'sunken');
31
my $w_frame_s1 = $w_frame->Scrollbar(-relief => 'sunken', -orient => 'horiz', -command => ['xview',$w_frame_e1]);
32
$w_frame_e1->configure(-xscrollcommand => ['set', $w_frame_s1]);
33
my $w_frame_f1 = $w_frame->Frame(-width => 20, -height => 10);
34
my $w_frame_e2 = $w_frame->Entry(-relief => 'sunken');
35
my $w_frame_s2 = $w_frame->Scrollbar(-relief => 'sunken', -orient => 'horiz', -command => ['xview', $w_frame_e2]);
36
$w_frame_e2->configure(-xscrollcommand => ['set', $w_frame_s2]);
37
my $w_frame_f2 = $w_frame->Frame(-width => 20, -height => 10);
38
my $w_frame_e3 = $w_frame->Entry(-relief => 'sunken');
39
my $w_frame_s3 = $w_frame->Scrollbar(-relief => 'sunken', -orient => 'horiz', -command => ['xview', $w_frame_e3]);
40
$w_frame_e3->configure(-xscrollcommand => ['set', $w_frame_s3]);
42
@pl = (-side => 'top', -fill => 'x');
43
$w_frame_e1->pack(@pl);
44
$w_frame_s1->pack(@pl);
45
$w_frame_f1->pack(@pl);
46
$w_frame_e2->pack(@pl);
47
$w_frame_s2->pack(@pl);
48
$w_frame_f2->pack(@pl);
49
$w_frame_e3->pack(@pl);
50
$w_frame_s3->pack(@pl);
52
$w_frame_e1->insert(0, "Initial value");
53
$w_frame_e2->insert('end', "This entry contains a long value, much too long ");
54
$w_frame_e2->insert('end', "to fit in the window at one time, so long in fact ");
55
$w_frame_e2->insert('end', "that you'll have to scan or scroll to see the end.");