~ubuntu-branches/ubuntu/natty/perl-tk/natty

« back to all changes in this revision

Viewing changes to demos/demos/widget_lib/mkEntry2.pl

  • Committer: Bazaar Package Importer
  • Author(s): Stephen Zander
  • Date: 2004-03-14 13:54:44 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040314135444-prc09u2or4dbr3to
Tags: 1:800.025-2
Add xlibs-dev to Build-Depends:,
Closes: #237942

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
 
2
 
 
3
 
sub mkEntry2 {
4
 
 
5
 
   # Create a top-level window that displays a bunch of entries with scrollbars.
6
 
 
7
 
    $mkEntry2->destroy if Exists($mkEntry2);
8
 
    $mkEntry2 = $top->Toplevel();
9
 
    my $w = $mkEntry2;
10
 
    dpos $w;
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 ' .
22
 
                           'seen enough.');
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');
26
 
    $w_msg->pack(@pl);
27
 
    $w_frame->pack(@pl);
28
 
    $w_ok->pack(-side => 'top');
29
 
 
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]);
41
 
 
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);
51
 
 
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.");
56
 
 
57
 
} # end mkEntry2
58
 
 
59
 
 
60
 
1;