OSDN Git Service

* cgen-asm.in: Update copyright year.
[pf3gnuchains/pf3gnuchains3x.git] / tk / doc / console.n
1 '\"
2 '\" Copyright (c) 2001 Donal K. Fellows
3 '\"
4 '\" See the file "license.terms" for information on usage and redistribution
5 '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
6 '\" 
7 '\" RCS: @(#) $Id$
8 '\"
9 .so man.macros
10 .TH console n 8.4 Tk "Tk Built-In Commands"
11 .BS
12 '\" Note:  do not modify the .SH NAME line immediately below!
13 .SH NAME
14 console \- Control the console on systems without a real console
15 .SH SYNOPSIS
16 \fBconsole title \fR?\fIstring\fR?
17 .sp
18 \fBconsole hide\fR
19 .sp
20 \fBconsole show\fR
21 .sp
22 \fBconsole eval \fIscript\fR
23 .BE
24
25 .SH DESCRIPTION
26 .PP
27 The console window is a replacement for a real console to allow input
28 and output on the standard I/O channels on platforms that do not have
29 a real console.  It is implemented as a separate interpreter with the
30 Tk toolkit loaded, and control over this interpreter is given through
31 the \fBconsole\fR command.  The behaviour of the console window is
32 defined mainly through the contents of the \fIconsole.tcl\fR file in
33 the Tk library (or the \fIConsole\fR resource on Macintosh systems.)
34 .PP
35 .TP
36 \fBconsole eval \fIscript\fR
37 Evaluate the \fIscript\fR argument as a Tcl script in the console
38 interpreter.  The normal interpreter is accessed through the
39 \fBconsoleinterp\fR command in the console interpreter.
40 .TP
41 \fBconsole hide\fR
42 Hide the console window from view.  Precisely equivalent to
43 withdrawing the \fB.\fR window in the console interpreter.
44 .TP
45 \fBconsole show\fR
46 Display the console window.  Precisely equivalent to deiconifying the
47 \fB.\fR window in the console interpreter.
48 .TP
49 \fBconsole title \fR?\fIstring\fR?
50 Query or modify the title of the console window.  If \fIstring\fR is
51 not specified, queries the title of the console window, and sets the
52 title of the console window to \fIstring\fR otherwise.  Precisely
53 equivalent to using the \fBwm title\fR command in the console
54 interpreter.
55
56 .SH "ACCESS TO THE MAIN INTERPRETER"
57 .PP
58 The \fBconsoleinterp\fR command in the console interpreter allows
59 scripts to be evaluated in the main interpreter.  It supports two
60 subcommands: \fBeval\fR and \fBrecord\fR.
61 .PP
62 .TP
63 \fBconsoleinterp eval \fIscript\fR
64 Evaluates \fIscript\fR as a Tcl script at the global level in the main
65 interpreter.
66 .TP
67 \fBconsoleinterp record \fIscript\fR
68 Records and evaluates \fIscript\fR as a Tcl script at the global level
69 in the main interpreter as if \fIscript\fR had been typed in at the
70 console.
71
72 .SH "ADDITIONAL TRAP CALLS"
73 .PP
74 There are several additional commands in the console interpreter that
75 are called in response to activity in the main interpreter.
76 \fIThese are documented here for completeness only; they form part of
77 the internal implementation of the console and are likely to change or
78 be modified without warning.\fR
79 .PP
80 Output to the console from the main interpreter via the stdout and
81 stderr channels is handled by invoking the \fBtk::ConsoleOutput\fR
82 command in the console interpreter with two arguments.  The first
83 argument is the name of the channel being written to, and the second
84 argument is the string being written to the channel (after encoding
85 and end-of-line translation processing has been performed.)
86 .PP
87 When the \fB.\fR window of the main interpreter is destroyed, the
88 \fBtk::ConsoleExit\fR command in the console interpreter is called
89 (assuming the console interpreter has not already been deleted itself,
90 that is.)
91
92 .SH "DEFAULT BINDINGS"
93 .PP
94 The default script creates a console window (implemented using a text
95 widget) that has the following behaviour:
96 .IP [1]
97 Pressing the tab key inserts a TAB character (as defined by the Tcl
98 \et escape.)
99 .IP [2]
100 Pressing the return key causes the current line (if complete by the
101 rules of \fBinfo complete\fR) to be passed to the main interpreter for
102 evaluation.
103 .IP [3]
104 Pressing the delete key deletes the selected text (if any text is
105 selected) or the character to the right of the cursor (if not at the
106 end of the line.)
107 .IP [4]
108 Pressing the backspace key deletes the selected text (if any text is
109 selected) or the character to the left of the cursor (of not at the
110 start of the line.)
111 .IP [5]
112 Pressing either Control+A or the home key causes the cursor to go to
113 the start of the line (but after the prompt, if a prompt is present on
114 the line.)
115 .IP [6]
116 Pressing either Control+E or the end key causes the cursor to go to
117 the end of the line.
118 .IP [7]
119 Pressing either Control+P or the up key causes the previous entry in
120 the command history to be selected.
121 .IP [8]
122 Pressing either Control+N or the down key causes the next entry in the
123 command history to be selected.
124 .IP [9]
125 Pressing either Control+B or the left key causes the cursor to move
126 one character backward as long as the cursor is not at the prompt.
127 .IP [10]
128 Pressing either Control+F or the right key causes the cursor to move
129 one character forward.
130 .IP [11]
131 Pressing F9 rebuilds the console window by destroying all its children
132 and reloading the Tcl script that defined the console's behaviour.
133 .PP
134 Most other behaviour is the same as a conventional text widget except
135 for the way that the \fI<<Cut>>\fR event is handled identically to the
136 \fI<<Copy>>\fR event.
137
138 .SH KEYWORDS
139 console, interpreter, window, interactive, output channels
140
141 .SH "SEE ALSO"
142 destroy(n), fconfigure(n), history(n), interp(n), puts(n), text(n), wm(n)