]> cvs.zerfleddert.de Git - micropolis/blame_incremental - src/tk/library/demos/mkBasic.tcl
rename setenv and unsetenv to not clash with functions provided by libc
[micropolis] / src / tk / library / demos / mkBasic.tcl
... / ...
CommitLineData
1# mkBasic w
2#
3# Create a top-level window that displays a basic text widget.
4#
5# Arguments:
6# w - Name to use for new top-level window.
7
8proc mkBasic {{w .basic}} {
9 catch {destroy $w}
10 toplevel $w
11 dpos $w
12 wm title $w "Text Demonstration - Basic Facilities"
13 wm iconname $w "Text Basics"
14 button $w.ok -text OK -command "destroy $w"
15 text $w.t -relief raised -bd 2 -yscrollcommand "$w.s set" -setgrid true
16 scrollbar $w.s -relief flat -command "$w.t yview"
17 pack append $w $w.ok {bottom fillx} $w.s {right filly} $w.t {expand fill}
18 $w.t insert 0.0 {\
19This window is a text widget. It displays one or more lines of text
20and allows you to edit the text. Here is a summary of the things you
21can do to a text widget:
22
231. Scrolling. Use the scrollbar to adjust the view in the text window.
24
252. Scanning. Press mouse button 2 in the text window and drag up or down.
26This will drag the text at high speed to allow you to scan its contents.
27
283. Insert text. Press mouse button 1 to set the insertion cursor, then
29type text. What you type will be added to the widget. You can backspace
30over what you've typed using either the backspace key, the delete key,
31or Control+h.
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 Control+d.
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 type Control+v to copy the
47selection to the point of the insertion cursor.
48
497. Resize the window. This widget has been configured with the "setGrid"
50option on, so that if you resize the window it will always resize to an
51even number of characters high and wide. Also, if you make the window
52narrow you can see that long lines automatically wrap around onto
53additional lines so that all the information is always visible.
54
55When you're finished with this demonstration, press the "OK" button
56below.}
57 $w.t mark set insert 0.0
58 bind $w <Any-Enter> "focus $w.t"
59}
Impressum, Datenschutz