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 / widget_lib / mkBasic.pl
CommitLineData
86530b38
AT
1
2
3sub mkBasic {
4
5 # Create a top-level window that displays a basic text widget.
6
7 $mkBasic->destroy if Exists($mkBasic);
8 $mkBasic = $top->Toplevel();
9 my $w = $mkBasic;
10 dpos $w;
11 $w->title('Text Demonstration - Basic Facilities');
12 $w->iconname('Text Basics');
13 my $w_ok = $w->Button(-text => 'OK', -width => 8, -command => ['destroy', $w]);
14 my $w_t = $w->Text(-relief => 'sunken', -bd => '2', -setgrid => 'true');
15 my $w_s = $w->Scrollbar(-command => ['yview', $w_t]);
16 $w_t->configure(-yscrollcommand => ['set', $w_s]);
17 $w_ok->pack(-side => 'bottom');
18 $w_s->pack(-side => 'right', -fill => 'y');
19 $w_t->pack(-expand => 'yes', -fill => 'both');
20
21 $w_t->insert('0.0', 'This window is a text widget. It displays one or more lines of text
22and allows you to edit the text. Here is a summary of the things you
23can do to a text widget:
24
251. Scrolling. Use the scrollbar to adjust the view in the text window.
26
272. Scanning. Press mouse button 2 in the text window and drag up or down.
28This will drag the text at high speed to allow you to scan its contents.
29
303. Insert text. Press mouse button 1 to set the insertion cursor, then
31type text. What you type will be added to the widget.
32
334. Select. Press mouse button 1 and drag to select a range of characters.
34Once you\'ve released the button, you can adjust the selection by pressing
35button 1 with the shift key down. This will reset the end of the
36selection nearest the mouse cursor and you can drag that end of the
37selection by dragging the mouse before releasing the mouse button.
38You can double-click to select whole words or triple-click to select
39whole lines.
40
415. Delete. To delete text, select the characters you\'d like to delete
42and type Backspace, Delete or Control-x.
43
446. Copy the selection. To copy the selection either from this window
45or from any other window or application, select what you want, click
46button 1 to set the insertion cursor, then click button 2 to copy the
47selection to the point of the insertion cursor.
48
497. Edit. Text widgets support the standard Motif editing characters
50plus many Emacs editing characters. Backspace and Control-h erase the
51character to the left of the insertion cursor. Delete and Control-d
52erase the character to the right of the insertion cursor. Control-w
53and Meta-backspace delete the word to the left of the insertion cursor,
54and Meta-d deletes the word to the right of the insertion cursor.
55Control-k deletes from the insertion cursor to the end of the line, or
56it deletes the newline character if that is the only thing left on the
57line. Control-o opens a new line by inserting a newline character to
58the right of the insertion cursor. Control-t transposes the two characters
59to the right of the insertion cursor.
60
618. Resize the window. This widget has been configured with the "setGrid"
62option on, so that if you resize the window it will always resize to an
63even number of characters high and wide. Also, if you make the window
64narrow you can see that long lines automatically wrap around onto
65additional lines so that all the information is always visible.
66
67When you\'re finished with this demonstration, press the "OK" button
68below.');
69
70 $w_t->mark('set', 'insert', '0.0');
71
72} # end mkBasic
73
74
751;