Textbox

Note

Textbox is derived from TextCtrl class.

This class currently simply presents a simpler to use interface for the TextCtrl – it can be thought of as a façade for that complicated class. Using it is preferable to using TextCtrl directly whenever possible because in the future some ports might implement Textbox but not the full set of TextCtrl features.

Other than different interface, this class is identical to TextCtrl. In particular, it uses the same events, same window styles and so on.


Constructor

Textbox class has a complex constructor:

object Textbox:new {
               number ID, string Name,
               object Parent, Text = 'My Textbox'
       }

Events

The following events are emitted by this class:

Event name Description
Widget.onEnter When the mouse moves onto this widget.
Widget.onLeave When the mouse moves out to this widget.

Inherited Methods

These methods are inherited from its super classes:

Class Method Description
Object:getID Returns object’s identifier.
Object:setID Sets the object identifier.
Object:getName Returns object’s name.
Object:setName Sets the object name.
Widget:getParent Returns object’s parent.
Widget:setParent Sets the object parent.
Widget:getPosX Returns object’s position related to X.
Widget:setPosX Sets the object position related to X.
Widget:getPosY Returns object’s position related to Y.
Widget:setPosY Sets the object position related to Y.
Widget:getWidth Returns object’s width.
Widget:setWidth Sets the object width.
Widget:getHeight Returns object’s height.
Widget:setHeight Sets the object height.
Widget:getwxObj Returns the wxWidgets object.
Control:getText Returns the button text.
Control:setText Sets the button text.
TextCtrl:saveFile Saves the contents of the control in a text file.
TextCtrl:loadFile Loads and displays the named file, if it exists.
TextCtrl:replace Replaces the text at the given position.
TextCtrl:remove Removes the text starting at the given position.
TextCtrl:positionToXY Converts given position to a zero-based column, line number pair.
TextCtrl:xyToPosition Converts the given zero based column and line number to a position.
TextCtrl:getSelection Gets the current selection span.
TextCtrl:getStringSelection Gets the text currently selected in the control.
TextCtrl:getLineLength Gets the length of the specified line.
TextCtrl:getLineText Returns the contents of a given line in the text control.
TextCtrl:getNumberOfLines Returns the number of lines in the text control buffer.
TextCtrl:isEditable Returns true if the controls contents may be edited by user.
TextCtrl:isModified Returns true if the text has been modified by user
TextCtrl:isMultiline Returns true if this is a multi line edit control and false otherwise.
TextCtrl:setMaxLength This function sets the maximum number of characters the user can enter into the control.
TextCtrl:setSelection Selects the text starting at the first position up to (but not including) the character at the last position.
TextCtrl:setEditable Makes the text item editable or read-only, overriding the TC_READONLY flag.
TextCtrl:canCut Returns true if the selection can be cut to the clipboard.
TextCtrl:canCopy Returns true if the selection can be copied to the clipboard.
TextCtrl:canPaste Returns true if the contents of the clipboard can be pasted into the text control.
TextCtrl:canUndo Returns true if there is an undo facility available and the last operation can be undone.
TextCtrl:canRedo Returns true if there is a redo facility available and the last operation can be redone.
TextCtrl:cutToClipboard Copies to the clipboard the text from ‘nFrom’ to ‘nTo’ and removes the selection.
TextCtrl:copyToClipboard Copies to the clipboard the text between ‘nFrom’ to ‘nTo’.
TextCtrl:pasteFromClipboard Pastes text from the clipboard to the text item.
TextCtrl:undo If there is an undo facility and the last operation can be undone, undoes the last operation.
TextCtrl:redo If there is a redo facility and the last operation can be redone, redoes the last operation.
TextCtrl:appendText Appends the text to the end of the text control.
TextCtrl:clear Clears the text in the control.
TextCtrl:markDirty Mark text as modified (dirty).
TextCtrl:discardEdits Resets the internal modified flag as if the current changes had been saved.
TextCtrl:getInsertionPoint Returns the insertion point.
TextCtrl:getLastPosition Returns the zero based index of the last position in the text control.
TextCtrl:getRange Returns the string containing the text starting in the positions from and up to to in the control.
TextCtrl:setInsertionPoint Sets the insertion point at the given position.
TextCtrl:setInsertionPointEnd Sets the insertion point at the end of the text control.
TextCtrl:writeText Writes the text into the text control at the current insertion position.
TextCtrl:showPosition Makes the line containing the given position visible.