GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  CURSES::UI::TEXTEDITOR (3)

.ds Aq ’

NAME

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

CONTENTS

CLASS HIERARCHY



 Curses::UI::Widget
 Curses::UI::Searchable
    |
    +----Curses::UI::TextEditor



SYNOPSIS



    use Curses::UI;
    my $cui = new Curses::UI;
    my $win = $cui->add(window_id, Window);

    my $editor = $win->add(
        myeditor, TextEditor,
        -vscrollbar => 1,
        -wrapping   => 1,
    );

    $editor->focus();
    my $text = $editor->get();



DESCRIPTION

Curses::UI::TextEditor is a widget that can be used to create a couple of different kinds of texteditors. These are:
o <B>multi-line texteditorB>

This is a multi-line text editor with features like word-wrapping, maximum textlength and undo.

o <B>single-line texteditorB>

The texteditor can be created as a single-line editor. Most of the features of the default texteditor will remain. Only the multi-line specific options will not be available (like moving up and down in the text).

o <B>read only texteditorB>

The texteditor can also be used in read only mode. In this mode, the texteditor will function as a text viewer. The user can walk through the text and search trough it.

See exampes/demo-Curses::UI::TextEditor in the distribution for a short demo of these.

STANDARD OPTIONS

<B>-parentB>, <B>-xB>, <B>-yB>, <B>-widthB>, <B>-heightB>, <B>-padB>, <B>-padleftB>, <B>-padrightB>, <B>-padtopB>, <B>-padbottomB>, <B>-ipadB>, <B>-ipadleftB>, <B>-ipadrightB>, <B>-ipadtopB>, <B>-ipadbottomB>, <B>-titleB>, <B>-titlefullwidthB>, <B>-titlereverseB>, <B>-onfocusB>, <B>-onblurB>

For an explanation of these standard options, see Curses::UI::Widget.

WIDGET-SPECIFIC OPTIONS

o <B>-textB> < TEXT >

This sets the initial text for the widget to TEXT.

o <B>-posB> < CURSOR_POSITION >

This sets the initial cursor position for the widget to CURSOR_POSITION. <B>-posB> represents the character index within <B>-textB>. By default this option is set to 0.

o <B>-readonlyB> < BOOLEAN >

The texteditor widget will be created as a read only texteditor (which is also called a textviewer) if BOOLEAN is true. By default BOOLEAN is false.

o <B>-singlelineB> < BOOLEAN >

The texteditor widget will be created as a single line texteditor (which is also called a textentry) if BOOLEAN is true. By default BOOLEAN is false.

o <B>-wrappingB> < BOOLEAN >

If BOOLEAN is true, the texteditor will have text wrapping enabled. By default BOOLEAN is false.

o <B>-showlinesB> < BOOLEAN >

If BOOLEAN is set to a true value, each editable line in the editor will show a line to type on. By default BOOLEAN is set to false.

o <B>-maxlengthB> < VALUE >

This sets the maximum allowed length of the text to VALUE. By default VALUE is set to 0, which means that the text may be infinitely long.

o <B>-maxlinesB> < VALUE >

This sets the maximum allowed number of lines for the text to SCALAR. By default VALUE is set to 0, which means that the text may contain an infinite number of lines.

o <B>-passwordB> < CHARACTER >

Instead of showing the real text in the widget, every character of the text will (on the screen) be replaced by CHARACTER. So creating a standard password field can be done by setting:



    -password => *



o <B>-regexpB> < REGEXP >

If characters are added to the texteditor, the new text will be matched against REGEXP. If the text does not match, the change will be denied. This can for example be used to force digit-only input on the texteditor:



    -regexp => /^\d*$/



o <B>-undolevelsB> < VALUE >

This option determines how many undolevels should be kept in memory for the texteditor widget. By default 10 levels are kept. If this value is set to 0, the number of levels is infinite.

o <B>-showoverflowB> < BOOLEAN >

If BOOLEAN is true, the text in the texteditor will be padded by an overflow character ($) if there is text outside the screen (like ’pico’ does). By default BOOLEAN is true.

o <B>-showhardreturnsB> < BOOLEAN >

If BOOLEAN is true, hard returns will be made visible by a diamond character. By default BOOLEAN is false.

o <B>-homeonblurB> < BOOLEAN >

If BOOLEAN is set to a true value, the cursor will move to the start of the text if the widget loses focus.

o <B>-toupperB> < BOOLEAN >

If BOOLEAN is true, all entered text will be converted to uppercase. By default BOOLEAN is false.

o <B>-tolowerB> < BOOLEAN >

If BOOLEAN is true, all entered text will be converted to lowercase. By default BOOLEAN is false.

o <B>-onchangeB> < CODEREF >

This sets the onChange event handler for the texteditor widget. If the text is changed by typing, the code in CODEREF will be executed. It will get the widget reference as its argument.

o <B>-reverseB> < BOOLEAN >

Makes the text drawn in reverse font.

METHODS

o <B>newB> ( OPTIONS )
o <B>layoutB> ( )
o <B>drawB> ( BOOLEAN )
o <B>focusB> ( )
o <B>onFocusB> ( CODEREF )
o <B>onBlurB> ( CODEREF )

These are standard methods. See Curses::UI::Widget for an explanation of these.

o <B>textB> ( [TEXT] )

If TEXT is defined, this will set the text of the widget to TEXT. To see the change, the widget needs to be redrawn by the <B>drawB> method. If TEXT is not defined, this method will return the current contents of the texteditor.

o <B>getB> ( )

This method will call <B>textB> without any arguments, so it will return the contents of the texteditor.

o <B>onChangeB> ( CODEREF )

This method can be used to set the <B>-onchangeB> event handler (see above) after initialization of the texteditor.

o <B>set_password_charB> ( $char )

This method can be used to change the password property. The password character will be set to $char, or turned off in $char is undef.

o <B>toggle_showhardreturnsB>

Toggles the -showhardreturns option.

o <B>toggle_showoverflowB>

Toggles the -showoverflow option.

o <B>toggle_wrappingB>

Toggles the -wrapping option.

DEFAULT BINDINGS

There are different sets of bindings for each mode in which this widget can be used.

    All modes (editor, single line and read only)

o <<B>tabB>>

Call the ’returreturnn’ routine. This will have the widget loose its focus.

o <<B>cursor-leftB>>, <<B>CTRL+BB>>

Call the ’cursor-left’ routine: move the cursor one position to the left.

o <<B>cursor-rightB>>, <<B>CTRL+FB>>

Call the ’cursor-right’ routine: move the cursor one position to the right.

o <<B>cursor-downB>>, <<B>CTRL+NB>>

Call the ’cursor-down’ routine: move the cursor one line down.

o <<B>cursor-upB>>, <<B>CTRL+PB>>

Call the ’cursor-up’ routine: move the cursor one line up.

o <<B>page-upB>>

Call the ’cursor-pageup’ routine: move the cursor to the previous page.

o <<B>page-downB>>

Call the ’cursor-pagedown’ routine: move the cursor to the next page.

o <<B>homeB>>

Call the ’cursor-home’ routine: go to the start of the text.

o <<B>endB>>

Call the ’cursor-end’ routine: go to the end of the text.

o <<B>CTRL+AB>>

Call the ’cursor-scrlinestart’ routine: move the cursor to the start of the current line.

o <<B>CTRL+EB>>

Call the ’cursor-scrlineend’ routine: move the cursor to the end of the current line.

o <<B>CTRL+WB>>

Call the ’toggle-wrapping’ routine: toggle the -wrapping option of the texteditor.

o <<B>CTRL+RB>>

Call the ’toggle-showhardreturns’ routine: toggle the -showhardreturns option of the texteditor.

o <<B>CTRL+TB>>

Call the ’toggle-showoverflow’ routine: toggle the -showoverflow option of the texteditor.

    All edit modes (all but read only mode)

o <<B>CTRL+YB>>, <<B>CTRL+XB>>

Call the ’delete-line’ routine: Delete the current line.

o <<B>CTRL+KB>>

Call the ’delete-till-eol’ routine: delete the text from the current cursor position up to the end of the current line.

o <<B>CTRL+UB>>

Call the ’clear-line’ routine: clear the current line and move the cursor to the start of this line.

o <<B>CTRL+DB>>

Call the ’delete-character’ routine: delete the character that currently is under the cursor.

o <<B>backspaceB>>

Call the ’backspace’ routine: delete the character this is before the current cursor position.

o <<B>CTRL+ZB>>

Call the ’undo’ routine: undo the last change to the text, up to <B>-undolevelsB> levels.

o <<B>CTRL+VB>>

Call the ’paste’ routine: this will paste the last deleted text at the current cursor position.

o <<B>any other keyB>>

Call the ’add-string’ routine: the character will be inserted in the text at the current cursor position.

    Only for the read only mode

o <<B>hB>>

Call the ’cursor-left’ routine: move the cursor one position to the left.

o <<B>lB>>

Call the ’cursor-right’ routine: move the cursor one position to the right.

o b<<k>>

Call the ’cursor-up’ routine: move the cursor one line up.

o b<<j>>

Call the ’cursor-down’ routine: move the cursor one line down.

o <<B>spaceB>>, <<B>]B>>

Call the ’cursor-pagedown’ routine: move the cursor to the next page.

o <<B>-B>>, <<B>[B>>

Call the ’cursor-pageup’ routine: move the cursor to the previous page.

o <<B>/B>>

Call the ’search-forward’ routine. This will make a ’less’-like search system appear in the textviewer. A searchstring can be entered. After that the user can search for the next occurance using the ’n’ key or the previous occurance using the ’N’ key.

o <<B>?B>>

Call the ’search-backward’ routine. This will do the same as the ’search-forward’ routine, only it will search in the opposite direction.

SEE ALSO

Curses::UI, Curses::UI::TextViewer Curses::UI::TextEntry Curses::UI::Widget, Curses::UI::Common

AUTHOR

Copyright (c) 2001-2002 Maurice Makaay. All rights reserved.

Maintained by Marcus Thiesen (marcus@cpan.thiesenweb.de)

This package is free software and is provided as is without express or implied warranty. It may be used, redistributed and/or modified under the same terms as perl itself.

Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 CURSES::UI::TEXTEDITOR (3) 2011-09-01

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.