Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / v9 / html / python / lib / curses-textpad-objects.html
CommitLineData
920dae64
AT
1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2<html>
3<head>
4<link rel="STYLESHEET" href="lib.css" type='text/css' />
5<link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" />
6<link rel='start' href='../index.html' title='Python Documentation Index' />
7<link rel="first" href="lib.html" title='Python Library Reference' />
8<link rel='contents' href='contents.html' title="Contents" />
9<link rel='index' href='genindex.html' title='Index' />
10<link rel='last' href='about.html' title='About this document...' />
11<link rel='help' href='about.html' title='About this document...' />
12<link rel="prev" href="module-curses.textpad.html" />
13<link rel="parent" href="module-curses.textpad.html" />
14<link rel="next" href="module-curses.wrapper.html" />
15<meta name='aesop' content='information' />
16<title>6.16.1 Textbox objects </title>
17</head>
18<body>
19<DIV CLASS="navigation">
20<div id='top-navigation-panel' xml:id='top-navigation-panel'>
21<table align="center" width="100%" cellpadding="0" cellspacing="2">
22<tr>
23<td class='online-navigation'><a rel="prev" title="6.16 curses.textpad "
24 href="module-curses.textpad.html"><img src='../icons/previous.png'
25 border='0' height='32' alt='Previous Page' width='32' /></A></td>
26<td class='online-navigation'><a rel="parent" title="6.16 curses.textpad "
27 href="module-curses.textpad.html"><img src='../icons/up.png'
28 border='0' height='32' alt='Up One Level' width='32' /></A></td>
29<td class='online-navigation'><a rel="next" title="6.17 curses.wrapper "
30 href="module-curses.wrapper.html"><img src='../icons/next.png'
31 border='0' height='32' alt='Next Page' width='32' /></A></td>
32<td align="center" width="100%">Python Library Reference</td>
33<td class='online-navigation'><a rel="contents" title="Table of Contents"
34 href="contents.html"><img src='../icons/contents.png'
35 border='0' height='32' alt='Contents' width='32' /></A></td>
36<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
37 border='0' height='32' alt='Module Index' width='32' /></a></td>
38<td class='online-navigation'><a rel="index" title="Index"
39 href="genindex.html"><img src='../icons/index.png'
40 border='0' height='32' alt='Index' width='32' /></A></td>
41</tr></table>
42<div class='online-navigation'>
43<b class="navlabel">Previous:</b>
44<a class="sectref" rel="prev" href="module-curses.textpad.html">6.16 curses.textpad </A>
45<b class="navlabel">Up:</b>
46<a class="sectref" rel="parent" href="module-curses.textpad.html">6.16 curses.textpad </A>
47<b class="navlabel">Next:</b>
48<a class="sectref" rel="next" href="module-curses.wrapper.html">6.17 curses.wrapper </A>
49</div>
50<hr /></div>
51</DIV>
52<!--End of Navigation Panel-->
53
54<H2><A NAME="SECTION0081610000000000000000"></A><A NAME="curses-textpad-objects"></A>
55<BR>
566.16.1 Textbox objects
57</H2>
58
59<P>
60You can instantiate a <tt class="class">Textbox</tt> object as follows:
61
62<P>
63<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
64 <td><nobr><b><span class="typelabel">class</span>&nbsp;<tt id='l2h-2147' xml:id='l2h-2147' class="class">Textbox</tt></b>(</nobr></td>
65 <td><var>win</var>)</td></tr></table></dt>
66<dd>
67Return a textbox widget object. The <var>win</var> argument should be a
68curses <tt class="class">WindowObject</tt> in which the textbox is to be contained.
69The edit cursor of the textbox is initially located at the upper left
70hand corner of the containing window, with coordinates <code>(0, 0)</code>.
71The instance's <tt class="member">stripspaces</tt> flag is initially on.
72</dl>
73
74<P>
75<tt class="class">Textbox</tt> objects have the following methods:
76
77<P>
78<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
79 <td><nobr><b><tt id='l2h-2148' xml:id='l2h-2148' class="method">edit</tt></b>(</nobr></td>
80 <td><var></var><big>[</big><var>validator</var><big>]</big><var></var>)</td></tr></table></dt>
81<dd>
82This is the entry point you will normally use. It accepts editing
83keystrokes until one of the termination keystrokes is entered. If
84<var>validator</var> is supplied, it must be a function. It will be called
85for each keystroke entered with the keystroke as a parameter; command
86dispatch is done on the result. This method returns the window
87contents as a string; whether blanks in the window are included is
88affected by the <tt class="member">stripspaces</tt> member.
89</dl>
90
91<P>
92<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
93 <td><nobr><b><tt id='l2h-2149' xml:id='l2h-2149' class="method">do_command</tt></b>(</nobr></td>
94 <td><var>ch</var>)</td></tr></table></dt>
95<dd>
96Process a single command keystroke. Here are the supported special
97keystrokes:
98
99<P>
100<div class="center"><table class="realtable">
101 <thead>
102 <tr>
103 <th class="left" >Keystroke</th>
104 <th class="left" >Action</th>
105 </tr>
106 </thead>
107 <tbody>
108 <tr><td class="left" valign="baseline"><tt class="constant">Control-A</tt></td>
109 <td class="left" >Go to left edge of window.</td></tr>
110 <tr><td class="left" valign="baseline"><tt class="constant">Control-B</tt></td>
111 <td class="left" >Cursor left, wrapping to previous line if appropriate.</td></tr>
112 <tr><td class="left" valign="baseline"><tt class="constant">Control-D</tt></td>
113 <td class="left" >Delete character under cursor.</td></tr>
114 <tr><td class="left" valign="baseline"><tt class="constant">Control-E</tt></td>
115 <td class="left" >Go to right edge (stripspaces off) or end of line
116 (stripspaces on).</td></tr>
117 <tr><td class="left" valign="baseline"><tt class="constant">Control-F</tt></td>
118 <td class="left" >Cursor right, wrapping to next line when appropriate.</td></tr>
119 <tr><td class="left" valign="baseline"><tt class="constant">Control-G</tt></td>
120 <td class="left" >Terminate, returning the window contents.</td></tr>
121 <tr><td class="left" valign="baseline"><tt class="constant">Control-H</tt></td>
122 <td class="left" >Delete character backward.</td></tr>
123 <tr><td class="left" valign="baseline"><tt class="constant">Control-J</tt></td>
124 <td class="left" >Terminate if the window is 1 line, otherwise
125 insert newline.</td></tr>
126 <tr><td class="left" valign="baseline"><tt class="constant">Control-K</tt></td>
127 <td class="left" >If line is blank, delete it, otherwise clear to
128 end of line.</td></tr>
129 <tr><td class="left" valign="baseline"><tt class="constant">Control-L</tt></td>
130 <td class="left" >Refresh screen.</td></tr>
131 <tr><td class="left" valign="baseline"><tt class="constant">Control-N</tt></td>
132 <td class="left" >Cursor down; move down one line.</td></tr>
133 <tr><td class="left" valign="baseline"><tt class="constant">Control-O</tt></td>
134 <td class="left" >Insert a blank line at cursor location.</td></tr>
135 <tr><td class="left" valign="baseline"><tt class="constant">Control-P</tt></td>
136 <td class="left" >Cursor up; move up one line.</td></tr></tbody>
137</table></div>
138
139<P>
140Move operations do nothing if the cursor is at an edge where the
141movement is not possible. The following synonyms are supported where
142possible:
143
144<P>
145<div class="center"><table class="realtable">
146 <thead>
147 <tr>
148 <th class="left" >Constant</th>
149 <th class="left" >Keystroke</th>
150 </tr>
151 </thead>
152 <tbody>
153 <tr><td class="left" valign="baseline"><tt class="constant">KEY_LEFT</tt></td>
154 <td class="left" ><kbd>Control-B</kbd></td></tr>
155 <tr><td class="left" valign="baseline"><tt class="constant">KEY_RIGHT</tt></td>
156 <td class="left" ><kbd>Control-F</kbd></td></tr>
157 <tr><td class="left" valign="baseline"><tt class="constant">KEY_UP</tt></td>
158 <td class="left" ><kbd>Control-P</kbd></td></tr>
159 <tr><td class="left" valign="baseline"><tt class="constant">KEY_DOWN</tt></td>
160 <td class="left" ><kbd>Control-N</kbd></td></tr>
161 <tr><td class="left" valign="baseline"><tt class="constant">KEY_BACKSPACE</tt></td>
162 <td class="left" ><kbd>Control-h</kbd></td></tr></tbody>
163</table></div>
164
165<P>
166All other keystrokes are treated as a command to insert the given
167character and move right (with line wrapping).
168</dl>
169
170<P>
171<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
172 <td><nobr><b><tt id='l2h-2150' xml:id='l2h-2150' class="method">gather</tt></b>(</nobr></td>
173 <td><var></var>)</td></tr></table></dt>
174<dd>
175This method returns the window contents as a string; whether blanks in
176the window are included is affected by the <tt class="member">stripspaces</tt>
177member.
178</dl>
179
180<P>
181<dl><dt><b><tt id='l2h-2151' xml:id='l2h-2151' class="member">stripspaces</tt></b></dt>
182<dd>
183This data member is a flag which controls the interpretation of blanks in
184the window. When it is on, trailing blanks on each line are ignored;
185any cursor motion that would land the cursor on a trailing blank goes
186to the end of that line instead, and trailing blanks are stripped when
187the window contents are gathered.
188</dl>
189
190<P>
191
192<DIV CLASS="navigation">
193<div class='online-navigation'>
194<p></p><hr />
195<table align="center" width="100%" cellpadding="0" cellspacing="2">
196<tr>
197<td class='online-navigation'><a rel="prev" title="6.16 curses.textpad "
198 href="module-curses.textpad.html"><img src='../icons/previous.png'
199 border='0' height='32' alt='Previous Page' width='32' /></A></td>
200<td class='online-navigation'><a rel="parent" title="6.16 curses.textpad "
201 href="module-curses.textpad.html"><img src='../icons/up.png'
202 border='0' height='32' alt='Up One Level' width='32' /></A></td>
203<td class='online-navigation'><a rel="next" title="6.17 curses.wrapper "
204 href="module-curses.wrapper.html"><img src='../icons/next.png'
205 border='0' height='32' alt='Next Page' width='32' /></A></td>
206<td align="center" width="100%">Python Library Reference</td>
207<td class='online-navigation'><a rel="contents" title="Table of Contents"
208 href="contents.html"><img src='../icons/contents.png'
209 border='0' height='32' alt='Contents' width='32' /></A></td>
210<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
211 border='0' height='32' alt='Module Index' width='32' /></a></td>
212<td class='online-navigation'><a rel="index" title="Index"
213 href="genindex.html"><img src='../icons/index.png'
214 border='0' height='32' alt='Index' width='32' /></A></td>
215</tr></table>
216<div class='online-navigation'>
217<b class="navlabel">Previous:</b>
218<a class="sectref" rel="prev" href="module-curses.textpad.html">6.16 curses.textpad </A>
219<b class="navlabel">Up:</b>
220<a class="sectref" rel="parent" href="module-curses.textpad.html">6.16 curses.textpad </A>
221<b class="navlabel">Next:</b>
222<a class="sectref" rel="next" href="module-curses.wrapper.html">6.17 curses.wrapper </A>
223</div>
224</div>
225<hr />
226<span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span>
227</DIV>
228<!--End of Navigation Panel-->
229<ADDRESS>
230See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
231</ADDRESS>
232</BODY>
233</HTML>