User Tools

Site Tools


TextBox (QLineEdit)


The Qt documentation in C++ of this class can be read here:

A control for the form object, is a one-line text editor.

It allows the user to enter and edit a single line of plain text with a useful collection of editing functions, including undo and redo, cut and paste, and drag and drop.

Most important

Methods IsValid
Properties Value , InputMask
Events OnEvent

Please read the control class overview Control as well.



Function IsValid () As Boolean

Returns true, if input mask and validation is valid for the current input text.


Sub SelectAll()

not implemented yet:

setDragEnabled isDragEnabled cursorPosition setcursorPosition bool isModified () const void setModified ( bool ) hasSelectedText redoAvailable : const bool selectedText : const QString undoAvailable : const bool void backspace () void cursorBackward ( bool mark, int steps = 1 ) void cursorForward ( bool mark, int steps = 1 ) void cursorWordBackward ( bool mark ) void cursorWordForward ( bool mark ) void del () void deselect () void end ( bool mark ) void home ( bool mark ) void insert ( const QString & newText ) int selectionStart () const void clear () void copy () const void cut () void paste () void redo () void undo ()



Property Alignment As String (ReadWrite)

How Value should be displayed. Should it be on top inside the boundaries of the control for example?


Property EchoMode As String (ReadWrite)

NormalDisplay characters as they are entered. This is the default.
NoEchoDo not display anything. This may be appropriate for passwords where even the length of the password should be kept secret.
PasswordDisplay asterisks instead of the characters actually entered.
PasswordEchoOnEditDisplay characters as they are entered while editing otherwise display asterisks.


Property Value As String (ReadWrite)


Property OldValue As String (ReadOnly)


Property Text As String (ReadWrite)

Same as Value. Provided for easy-use.


Property InputMask As String (ReadWrite)

Holds the validation input mask.

Possible characters may be (Qt original documentation)

A ASCII alphabetic character required. A-Z, a-z.
a ASCII alphabetic character permitted but not required.
N ASCII alphanumeric character required. A-Z, a-z, 0-9.
n ASCII alphanumeric character permitted but not required.
X Any character required.
x Any character permitted but not required.
9 ASCII digit required. 0-9.
0 ASCII digit permitted but not required.
D ASCII digit required. 1-9.
d ASCII digit permitted but not required (1-9).
# ASCII digit or plus/minus sign permitted but not required.
H Hexadecimal character required. A-F, a-f, 0-9.
h Hexadecimal character permitted but not required.
B Binary character required. 0-1.
b Binary character permitted but not required.
> All following alphabetic characters are uppercased.
< All following alphabetic characters are lowercased.
! Switch off case conversion.
\ Use \ to escape the special characters listed above to use them as separators

The mask consists of a string of mask characters and separators, optionally followed by a semicolon and the character used for blanks: the blank characters are always removed from the text after editing. The default blank character is space.

Example;_	IP address; blanks are _.
HH:HH:HH:HH:HH:HH;_	MAC address
0000-00-00	ISO Date; blanks are space
>AAAAA-AAAAA-AAAAA-AAAAA-AAAAA;#	License number; blanks are - and all (alphabetic) characters are converted to uppercase.


Property ReadOnly As Boolean (ReadWrite)

If it is true, the textbox value cannot be changed by the user.


Property ValidatorDouble As Boolean (ReadWrite)

If it is true, the textbox value maybe a double value.


Property ValidatorInteger As Boolean (ReadWrite)

If it is true, the textbox value maybe an integer value.


Property Maximum As Integer (ReadWrite)

Defines how many characters may be entered.


Property Completer As String (ReadWrite)

Containts a list of words to be used to auto-complete text input. Words may be separated by ; or ,

not implemented yet:




Sub OnEvent()

This event is raised, whenever the user finished editing, which means that Return or Enter key is pressed or the TextBox loses focus. Note that if there is a validator or InputMask set and enter/return is pressed, the Event() will only be raised if the input follows the InputMask and one of the validators.


Sub TextBox0_OnEvent()
  Print "TextBox0 pressed"
End Sub


Sub OnCursorPositionChanged(Old As Integer, New As Integer)

Implemented since KBasic V1.89e.


Sub OnEditingFinished()

Implemented since KBasic V1.89e.


Sub OnSelectionChanged()

Implemented since KBasic V1.89e.


Sub OnTextChanged()

Implemented since KBasic V1.89e.


Sub OnTextEdited()

Implemented since KBasic V1.89e.

textbox.txt · Last modified: 2013/04/09 22:58 (external edit)