back to gui 

wxTextCtrl

generated from ../src/mod_gui/control/textctrl.cpp

A text control allows text to be displayed and edited. It may be single line or multi-line. section wxTextCtrl_proto Prototype

Constants

Style

Name Description
PROCESS_ENTER
PROCESS_TAB
MULTILINE
PASSWORD
READONLY
RICH

Constructor

wxTextCtrl

wxTextCtrl()
 
wxTextCtrl(Parent, 
           Id, 
           Text, 
           Position = wxDefaultPosition, 
           Size = wxDefaultSize, 
           Validator = null)
 
Name Type Default Description
Parent wxWindow The parent of the text control.
Id Integer The unique id
Text String The default text
Position wxPoint wxDefaultPosition The position of the control.
Size wxSize wxDefaultSize The size of the control.
Validator wxValidator null

Constructs a new wxTextCtrl object

Properties

Name Type Description
canCopy read only Boolean Returns true if the selection can be copied to the clipboard.
canCut read only Boolean Returns true when the selection can be cut to the clipboard.
canPaste read only Boolean Returns true when the contents of clipboard can be pasted into the text control.
canRedo read only Boolean Returns true if there is a redo facility available and the last operation can be redone.
canUndo read only Boolean Returns true if there is an undo facility available and the last operation can be undone.
editable Boolean Enables/Disables the text control
empty read only Boolean Returns true if the control is currently empty.
insertionPoint Integer Get/Sets the insertion point
lastPosition read only Integer Get the position of the last character in the text control
modified read only Boolean Returns true when the text is changed
multiLine read only Boolean Returns true if this is a multi line edit control and false otherwise.
numberOfLines read only Integer Get the number of lines
singleLine read only Boolean Returns true if this is a single line edit control and false otherwise.
value String Get/Set the text

Methods

appendText

appendText(Text)
 
Name Type Default Description
Text String Text to append

Appends the text to the text of the control.

clear

clear()
 

Removes the text.

cut

cut()
 

Removes the selected text and copies it to the clipboard.

discardEdits

discardEdits()
 

Resets the modified flag

getLineLength

getLineLength(Line) : Integer
 
Name Type Default Description
Line Integer The line number

Returns the length of the given line

getLineText

getLineText(Line) : String
 
Name Type Default Description
Line Integer The line number

Returns the text of the given line

loadFile

loadFile(File)
 
Name Type Default Description
File String The name of a file

Loads a file into the text control

paste

paste()
 

Pastes the content of the clipboard in the selection of the text control.

redo

redo()
 

Tries to redo the last operation

remove

remove(From, 
       To)
 
Name Type Default Description
From Integer
To Integer

Removes the text between From and To.

replace

replace(From, 
        To, 
        Text)
 
Name Type Default Description
From Integer
To Integer
Text String

Replaces the text between From and To with the new text

saveFile

saveFile(File) : Boolean
 
Name Type Default Description
File String

Saves the content of the text control to the given file

setSelection

setSelection(From = 0, 
             To)
 
Name Type Default Description
From Integer 0 When not specified, 0 is used.
To Integer When not specified, the end position is used.

Selects the text between From and To.

Events

onText Triggered when the text is changed. The argument of the function is wxCommandEvent
onTextEnter Triggered when the enter key is pressed in a single-line text control. The argument of the function is wxCommandEvent
onTextURL A mouse event occurred over an URL in the text control (wxMSW and wxGTK2 only)
onTextMaxLen User tried to enter more text into the control than the limit set by setMaxLength



Design downloaded from Zeroweb.org: Free website templates, layouts, and tools.