1Curses::UI::TextEditor(U3s)er Contributed Perl DocumentatCiuornses::UI::TextEditor(3)
2
3
4

NAME

6       Curses::UI::TextEditor - Create and manipulate texteditor widgets
7

CLASS HIERARCHY

9        Curses::UI::Widget
10        Curses::UI::Searchable
11           |
12           +----Curses::UI::TextEditor
13

SYNOPSIS

15           use Curses::UI;
16           my $cui = new Curses::UI;
17           my $win = $cui->add('window_id', 'Window');
18
19           my $editor = $win->add(
20               'myeditor', 'TextEditor',
21               -vscrollbar => 1,
22               -wrapping   => 1,
23           );
24
25           $editor->focus();
26           my $text = $editor->get();
27

DESCRIPTION

29       Curses::UI::TextEditor is a widget that can be used to create a couple
30       of different kinds of texteditors. These are:
31
32       ·   multi-line texteditor
33
34           This is a multi-line text editor with features like word-wrapping,
35           maximum textlength and undo.
36
37       ·   single-line texteditor
38
39           The texteditor can be created as a single-line editor.  Most of the
40           features of the default texteditor will remain.  Only the multi-
41           line specific options will not be available (like moving up and
42           down in the text).
43
44       ·   read only texteditor
45
46           The texteditor can also be used in read only mode.  In this mode,
47           the texteditor will function as a text viewer. The user can walk
48           through the text and search trough it.
49
50       See exampes/demo-Curses::UI::TextEditor in the distribution for a short
51       demo of these.
52

STANDARD OPTIONS

54       -parent, -x, -y, -width, -height, -pad, -padleft, -padright, -padtop,
55       -padbottom, -ipad, -ipadleft, -ipadright, -ipadtop, -ipadbottom,
56       -title, -titlefullwidth, -titlereverse, -onfocus, -onblur
57
58       For an explanation of these standard options, see Curses::UI::Widget.
59

WIDGET-SPECIFIC OPTIONS

61       ·   -text < TEXT >
62
63           This sets the initial text for the widget to TEXT.
64
65       ·   -pos < CURSOR_POSITION >
66
67           This sets the initial cursor position for the widget to
68           CURSOR_POSITION. -pos represents the character index within -text.
69           By default this option is set to 0.
70
71       ·   -readonly < BOOLEAN >
72
73           The texteditor widget will be created as a read only texteditor
74           (which is also called a textviewer) if BOOLEAN is true. By default
75           BOOLEAN is false.
76
77       ·   -singleline < BOOLEAN >
78
79           The texteditor widget will be created as a single line texteditor
80           (which is also called a textentry) if BOOLEAN is true. By default
81           BOOLEAN is false.
82
83       ·   -wrapping < BOOLEAN >
84
85           If BOOLEAN is true, the texteditor will have text wrapping enabled.
86           By default BOOLEAN is false.
87
88       ·   -showlines < BOOLEAN >
89
90           If BOOLEAN is set to a true value, each editable line in the editor
91           will show a line to type on. By default BOOLEAN is set to false.
92
93       ·   -maxlength < VALUE >
94
95           This sets the maximum allowed length of the text to VALUE. By
96           default VALUE is set to 0, which means that the text may be
97           infinitely long.
98
99       ·   -maxlines < VALUE >
100
101           This sets the maximum allowed number of lines for the text to
102           SCALAR. By default VALUE is set to 0, which means that the text may
103           contain an infinite number of lines.
104
105       ·   -password < CHARACTER >
106
107           Instead of showing the real text in the widget, every character of
108           the text will (on the screen) be replaced by CHARACTER. So creating
109           a standard password field can be done by setting:
110
111               -password => '*'
112
113       ·   -regexp < REGEXP >
114
115           If characters are added to the texteditor, the new text will be
116           matched against REGEXP. If the text does not match, the change will
117           be denied. This can for example be used to force digit-only input
118           on the texteditor:
119
120               -regexp => '/^\d*$/'
121
122       ·   -undolevels < VALUE >
123
124           This option determines how many undolevels should be kept in memory
125           for the texteditor widget. By default 10 levels are kept. If this
126           value is set to 0, the number of levels is infinite.
127
128       ·   -showoverflow < BOOLEAN >
129
130           If BOOLEAN is true, the text in the texteditor will be padded by an
131           overflow character ($) if there is text outside the screen (like
132           'pico' does). By default BOOLEAN is true.
133
134       ·   -showhardreturns < BOOLEAN >
135
136           If BOOLEAN is true, hard returns will be made visible by a diamond
137           character. By default BOOLEAN is false.
138
139       ·   -homeonblur < BOOLEAN >
140
141           If BOOLEAN is set to a true value, the cursor will move to the
142           start of the text if the widget loses focus.
143
144       ·   -toupper < BOOLEAN >
145
146           If BOOLEAN is true, all entered text will be converted to
147           uppercase. By default BOOLEAN is false.
148
149       ·   -tolower < BOOLEAN >
150
151           If BOOLEAN is true, all entered text will be converted to
152           lowercase. By default BOOLEAN is false.
153
154       ·   -onchange < CODEREF >
155
156           This sets the onChange event handler for the texteditor widget.  If
157           the text is changed by typing, the code in CODEREF will be
158           executed.  It will get the widget reference as its argument.
159
160       ·   -reverse < BOOLEAN >
161
162           Makes the text drawn in reverse font.
163

METHODS

165       ·   new ( OPTIONS )
166
167       ·   layout ( )
168
169       ·   draw ( BOOLEAN )
170
171       ·   focus ( )
172
173       ·   onFocus ( CODEREF )
174
175       ·   onBlur ( CODEREF )
176
177           These are standard methods. See Curses::UI::Widget for an
178           explanation of these.
179
180       ·   text ( [TEXT] )
181
182           If TEXT is defined, this will set the text of the widget to TEXT.
183           To see the change, the widget needs to be redrawn by the draw
184           method.  If TEXT is not defined, this method will return the
185           current contents of the texteditor.
186
187       ·   get ( )
188
189           This method will call text without any arguments, so it will return
190           the contents of the texteditor.
191
192       ·   onChange ( CODEREF )
193
194           This method can be used to set the -onchange event handler (see
195           above) after initialization of the texteditor.
196
197       ·   set_password_char ( $char )
198
199           This method can be used to change the password property.  The
200           password character will be set to $char, or turned off in $char is
201           undef.
202

DEFAULT BINDINGS

204       There are different sets of bindings for each mode in which this widget
205       can be used.
206
207   All modes (editor, single line and read only)
208       ·   <tab>
209
210           Call the 'returreturnn' routine. This will have the widget loose
211           its focus.
212
213       ·   <cursor-left>, <CTRL+B>
214
215           Call the 'cursor-left' routine: move the cursor one position to the
216           left.
217
218       ·   <cursor-right>, <CTRL+F>
219
220           Call the 'cursor-right' routine: move the cursor one position to
221           the right.
222
223       ·   <cursor-down>, <CTRL+N>
224
225           Call the 'cursor-down' routine: move the cursor one line down.
226
227       ·   <cursor-up>, <CTRL+P>
228
229           Call the 'cursor-up' routine: move the cursor one line up.
230
231       ·   <page-up>
232
233           Call the 'cursor-pageup' routine: move the cursor to the previous
234           page.
235
236       ·   <page-down>
237
238           Call the 'cursor-pagedown' routine: move the cursor to the next
239           page.
240
241       ·   <home>
242
243           Call the 'cursor-home' routine: go to the start of the text.
244
245       ·   <end>
246
247           Call the 'cursor-end' routine: go to the end of the text.
248
249       ·   <CTRL+A>
250
251           Call the 'cursor-scrlinestart' routine: move the cursor to the
252           start of the current line.
253
254       ·   <CTRL+E>
255
256           Call the 'cursor-scrlineend' routine: move the cursor to the end of
257           the current line.
258
259       ·   <CTRL+W>
260
261           Call the 'toggle-wrapping' routine: toggle the -wrapping option of
262           the texteditor.
263
264       ·   <CTRL+R>
265
266           Call the 'toggle-showhardreturns' routine: toggle the
267           -showhardreturns option of the texteditor.
268
269       ·   <CTRL+T>
270
271           Call the 'toggle-showoverflow' routine: toggle the -showoverflow
272           option of the texteditor.
273
274   All edit modes (all but read only mode)
275       ·   <CTRL+Y>, <CTRL+X>
276
277           Call the 'delete-line' routine: Delete the current line.
278
279       ·   <CTRL+K>
280
281           Call the 'delete-till-eol' routine: delete the text from the
282           current cursor position up to the end of the current line.
283
284       ·   <CTRL+U>
285
286           Call the 'clear-line' routine: clear the current line and move the
287           cursor to the start of this line.
288
289       ·   <CTRL+D>
290
291           Call the 'delete-character' routine: delete the character that
292           currently is under the cursor.
293
294       ·   <backspace>
295
296           Call the 'backspace' routine: delete the character this is before
297           the current cursor position.
298
299       ·   <CTRL+Z>
300
301           Call the 'undo' routine: undo the last change to the text, up to
302           -undolevels levels.
303
304       ·   <CTRL+V>
305
306           Call the 'paste' routine: this will paste the last deleted text at
307           the current cursor position.
308
309       ·   <any other key>
310
311           Call the 'add-string' routine: the character will be inserted in
312           the text at the current cursor position.
313
314   Only for the read only mode
315       ·   <h>
316
317           Call the 'cursor-left' routine: move the cursor one position to the
318           left.
319
320       ·   <l>
321
322           Call the 'cursor-right' routine: move the cursor one position to
323           the right.
324
325       ·   b<<k>>
326
327           Call the 'cursor-up' routine: move the cursor one line up.
328
329       ·   b<<j>>
330
331           Call the 'cursor-down' routine: move the cursor one line down.
332
333       ·   <space>, <]>
334
335           Call the 'cursor-pagedown' routine: move the cursor to the next
336           page.
337
338       ·   <->, <[>
339
340           Call the 'cursor-pageup' routine: move the cursor to the previous
341           page.
342
343       ·   </>
344
345           Call the 'search-forward' routine. This will make a 'less'-like
346           search system appear in the textviewer. A searchstring can be
347           entered. After that the user can search for the next occurance
348           using the 'n' key or the previous occurance using the 'N' key.
349
350       ·   <?>
351
352           Call the 'search-backward' routine. This will do the same as the
353           'search-forward' routine, only it will search in the opposite
354           direction.
355

SEE ALSO

357       Curses::UI, Curses::UI::TextViewer Curses::UI::TextEntry
358       Curses::UI::Widget, Curses::UI::Common
359

AUTHOR

361       Copyright (c) 2001-2002 Maurice Makaay. All rights reserved.
362
363       Maintained by Marcus Thiesen (marcus@cpan.thiesenweb.de)
364
365       This package is free software and is provided "as is" without express
366       or implied warranty. It may be used, redistributed and/or modified
367       under the same terms as perl itself.
368
369
370
371perl v5.12.0                      2008-12-21         Curses::UI::TextEditor(3)
Impressum