source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/vrippack-0.31/lib/linux/tk8.4/demos/text.tcl @ 37

Last change on this file since 37 was 37, checked in by (none), 14 years ago

Added original make3d

File size: 3.6 KB
Line 
1# text.tcl --
2#
3# This demonstration script creates a text widget that describes
4# the basic editing functions.
5#
6# RCS: @(#) $Id: text.tcl,v 1.3 2001/11/15 11:55:26 dkf Exp $
7
8if {![info exists widgetDemo]} {
9    error "This script should be run from the \"widget\" demo."
10}
11
12set w .text
13catch {destroy $w}
14toplevel $w
15wm title $w "Text Demonstration - Basic Facilities"
16wm iconname $w "text"
17positionWindow $w
18
19frame $w.buttons
20pack $w.buttons -side bottom -fill x -pady 2m
21button $w.buttons.dismiss -text Dismiss -command "destroy $w"
22button $w.buttons.code -text "See Code" -command "showCode $w"
23pack $w.buttons.dismiss $w.buttons.code -side left -expand 1
24
25text $w.text -relief sunken -bd 2 -yscrollcommand "$w.scroll set" -setgrid 1 \
26        -height 30 -undo 1 -autosep 1
27scrollbar $w.scroll -command "$w.text yview"
28pack $w.scroll -side right -fill y
29pack $w.text -expand yes -fill both
30$w.text insert 0.0 \
31{This window is a text widget.  It displays one or more lines of text
32and allows you to edit the text.  Here is a summary of the things you
33can do to a text widget:
34
351. Scrolling. Use the scrollbar to adjust the view in the text window.
36
372. Scanning. Press mouse button 2 in the text window and drag up or down.
38This will drag the text at high speed to allow you to scan its contents.
39
403. Insert text. Press mouse button 1 to set the insertion cursor, then
41type text.  What you type will be added to the widget.
42
434. Select. Press mouse button 1 and drag to select a range of characters.
44Once you've released the button, you can adjust the selection by pressing
45button 1 with the shift key down.  This will reset the end of the
46selection nearest the mouse cursor and you can drag that end of the
47selection by dragging the mouse before releasing the mouse button.
48You can double-click to select whole words or triple-click to select
49whole lines.
50
515. Delete and replace. To delete text, select the characters you'd like
52to delete and type Backspace or Delete.  Alternatively, you can type new
53text, in which case it will replace the selected text.
54
556. Copy the selection. To copy the selection into this window, select
56what you want to copy (either here or in another application), then
57click button 2 to copy the selection to the point of the mouse cursor.
58
597. Edit.  Text widgets support the standard Motif editing characters
60plus many Emacs editing characters.  Backspace and Control-h erase the
61character to the left of the insertion cursor.  Delete and Control-d
62erase the character to the right of the insertion cursor.  Meta-backspace
63deletes the word to the left of the insertion cursor, and Meta-d deletes
64the word to the right of the insertion cursor.  Control-k deletes from
65the insertion cursor to the end of the line, or it deletes the newline
66character if that is the only thing left on the line.  Control-o opens
67a new line by inserting a newline character to the right of the insertion
68cursor.  Control-t transposes the two characters on either side of the
69insertion cursor.  Control-z undoes the last editing action performed,
70and }
71
72switch $tcl_platform(platform) {
73    "unix" - "macintosh" {
74        $w.text insert end "Control-Shift-z"
75    }
76    "windows" {
77        $w.text insert end "Control-y"
78    }
79}
80
81$w.text insert end { redoes undone edits.
82
837. Resize the window.  This widget has been configured with the "setGrid"
84option on, so that if you resize the window it will always resize to an
85even number of characters high and wide.  Also, if you make the window
86narrow you can see that long lines automatically wrap around onto
87additional lines so that all the information is always visible.}
88$w.text mark set insert 0.0
Note: See TracBrowser for help on using the repository browser.