Using IlvText
The class IlvText defines a multiline text editor. Since IlvText is a subclass of IlvScrolledGadget, the text editor has scrollbars.
A Multiline Text Editor
The class IlvText provides a large number of member functions for setting or retrieving text, and for switching between the edit and read-only modes.
For details about handling scrollbars, see the base class IlvScrolledGadget.
This section covers the following topics:
Setting and Retrieving Text
You can specify the content of an IlvText object with the virtual member function setText and retrieve it with getText.
You can also set the text of a specific line with setLine and retrieve it with getLine.
You can add a line or remove a line with addLine and removeLine.
The class IlvText has many other helpful methods to set or retrieve several lines. See the Reference Manual for more information on these member functions.
Event Handling
This section covers the following topics:
The check Method
Each time the user types a regular ASCII character in a text gadget, the virtual member function check is called. Its default implementation removes the selected text and adds the character that the user enters at the current cursor location.
Keyboard Shortcuts
The following table lists the keyboard shortcuts that can be used with text fields:
Key
Behavior
Home or Ctrl+A
Moves the cursor to the beginning of the line.
Meta <
Moves the cursor to the beginning of the text.
Meta >
Moves the cursor to the end of the text.
End or Ctrl+E
Moves the cursor to the end of the line.
Left arrow key or Ctrl+B
Moves the cursor left one character.
Right arrow key or Ctrl+F
Moves the cursor right one character.
Up key or Ctrl+P
Moves the cursor up one line.
Down key or Ctrl+N
Moves the cursor down one line.
Page Up
Moves the cursor one page up.
Page Down
Moves the cursor one page down.
Ctrl+K
Removes the text after the cursor.
Del or Ctrl+D
Removes the character after the cursor.
Back Space or Ctrl+H
Removes the character before the cursor.
Ctrl+X
Cuts the selected text to the clipboard.
Ctrl+C
Copies the selected text to the clipboard.
Ctrl+V
Pastes text from the clipboard.
Ctrl+Insert (Windows®)
Copies the selected text to the clipboard.
Shift+Insert (Windows)
Pastes text from the clipboard.
Ctrl+Left, Ctrl+Right
Moves the cursor one word backward or forward.
Shift+Left, Shift+Right
Shift+Up, Shift+Down
Extends the selection one character up, down, left or right.
Ctrl+Shift+Left, Ctrl+Shift+Right
Extends the selection one word to the left or to the right.
Shift+Home, Shift+End
Extends the selection to the beginning or end of the line.
Ctrl+Shift+Home
Ctrl+Shift+End
Extends the selection to the beginning or end of the text.
Published date: 05/24/2022
Last modified date: 02/24/2022