Class | Fox::FXText |
In: |
rdoc-sources/FXText.rb
|
Parent: | FXScrollArea |
The text widget supports editing of multiple lines of text. An optional style table can provide text coloring based on the contents of an optional parallel style buffer, which is maintained as text is edited. In a typical scenario, the contents of the style buffer is either directly written when the text is added to the widget, or is continually modified by editing the text via syntax-based highlighting engine which colors the text based on syntactical patterns.
The following messages are sent by FXText to its target:
SEL_KEYPRESS: | sent when a key is pressed; the message data is an FXEvent instance. |
SEL_KEYRELEASE: | sent when a key is released; the message data is an FXEvent instance. |
SEL_LEFTBUTTONPRESS: | sent when the left mouse button goes down; the message data is an FXEvent instance. |
SEL_LEFTBUTTONRELEASE: | sent when the left mouse button goes up; the message data is an FXEvent instance. |
SEL_MIDDLEBUTTONPRESS: | sent when the middle mouse button goes down; the message data is an FXEvent instance. |
SEL_MIDDLEBUTTONRELEASE: | sent when the middle mouse button goes up; the message data is an FXEvent instance. |
SEL_RIGHTBUTTONPRESS: | sent when the right mouse button goes down; the message data is an FXEvent instance. |
SEL_RIGHTBUTTONRELEASE: | sent when the right mouse button goes up; the message data is an FXEvent instance. |
SEL_INSERTED: | sent after text is inserted into the text buffer; the message data is a reference to an FXTextChange instance. |
SEL_DELETED: | sent after text is removed from the text buffer; the message data is a reference to an FXTextChange instance. |
SEL_REPLACED: | sent after some text is replaced in the text buffer; the message data is a reference to an FXTextChange instance. |
SEL_CHANGED: | sent when the contents of the text buffer change in any way; the message data is an integer indicating the cursor position. |
SEL_SELECTED: | sent after text is selected; the message data is a two-element array indicating the starting position of the selected text and the number of characters selected. |
SEL_DESELECTED: | sent before text is deselected; the message data is a two-element array indicating the starting position of the deselected text and the number of characters deselected. |
TEXT_READONLY: | Text is not editable |
TEXT_WORDWRAP: | Wrap at word breaks |
TEXT_OVERSTRIKE: | Overstrike mode |
TEXT_FIXEDWRAP: | Fixed wrap columns |
TEXT_NO_TABS: | Insert spaces for tabs |
TEXT_AUTOINDENT: | Autoindent |
TEXT_SHOWACTIVE: | Show active line |
TEXT_AUTOSCROLL: | Logging mode, keeping last line visible |
SELECT_CHARS SELECT_WORDS SELECT_LINES
STYLE_UNDERLINE: | underline text |
STYLE_STRIKEOUT: | strike out text |
STYLE_BOLD_: | bold text |
ID_CURSOR_TOP:: ID_CURSOR_BOTTOM:: ID_CURSOR_HOME:: ID_CURSOR_END:: ID_CURSOR_RIGHT:: ID_CURSOR_LEFT:: ID_CURSOR_UP:: ID_CURSOR_DOWN:: ID_CURSOR_WORD_LEFT:: ID_CURSOR_WORD_RIGHT:: ID_CURSOR_PAGEDOWN:: ID_CURSOR_PAGEUP:: ID_CURSOR_SCRNTOP:: ID_CURSOR_SCRNBTM:: ID_CURSOR_SCRNCTR:: ID_CURSOR_PAR_HOME:: ID_CURSOR_PAR_END:: ID_SCROLL_UP:: ID_SCROLL_DOWN:: ID_MARK:: ID_EXTEND:: ID_OVERST_STRING:: ID_INSERT_STRING:: ID_INSERT_NEWLINE:: ID_INSERT_TAB:: ID_CUT_SEL:: ID_COPY_SEL:: ID_PASTE_SEL:: ID_DELETE_SEL:: ID_SELECT_CHAR:: ID_SELECT_WORD:: ID_SELECT_LINE:: ID_SELECT_ALL:: ID_SELECT_MATCHING:: ID_SELECT_BRACE:: ID_SELECT_BRACK:: ID_SELECT_PAREN:: ID_SELECT_ANG:: ID_DESELECT_ALL:: ID_BACKSPACE:: ID_BACKSPACE_WORD:: ID_BACKSPACE_BOL:: ID_DELETE:: ID_DELETE_WORD:: ID_DELETE_EOL:: ID_DELETE_LINE:: ID_TOGGLE_EDITABLE:: ID_TOGGLE_OVERSTRIKE:: ID_CURSOR_ROW:: ID_CURSOR_COLUMN:: ID_CLEAN_INDENT:: ID_SHIFT_LEFT:: ID_SHIFT_RIGHT:: ID_SHIFT_TABLEFT:: ID_SHIFT_TABRIGHT:: ID_UPPER_CASE:: ID_LOWER_CASE:: ID_GOTO_MATCHING:: ID_GOTO_SELECTED:: ID_GOTO_LINE:: ID_SEARCH_FORW_SEL:: ID_SEARCH_BACK_SEL:: ID_SEARCH:: ID_REPLACE:: ID_LEFT_BRACE:: ID_LEFT_BRACK:: ID_LEFT_PAREN:: ID_LEFT_ANG:: ID_RIGHT_BRACE:: ID_RIGHT_BRACK:: ID_RIGHT_PAREN:: ID_RIGHT_ANG:: ID_BLINK:: ID_FLASH::
activeBackColor | [RW] | Active background color [FXColor] |
anchorPos | [RW] | Anchor position [Integer] |
barColor | [RW] | Bar color [FXColor] |
barColumns | [RW] | Number of columns used for line numbers [Integer] |
cursorCol | [RW] | Cursor column [Integer] |
cursorColor | [RW] | Cursor color [FXColor] |
cursorPos | [R] | Cursor position [Integer] |
cursorRow | [RW] | Cursor row [Integer] |
delimiters | [RW] | Word delimiters [String] |
editable | [W] | Indicates whether text is editable [Boolean] |
font | [RW] | Text font [FXFont] |
helpText | [RW] | Status line help text [String] |
hiliteBackColor | [RW] | Highlight text background color [FXColor] |
hiliteMatchTime | [RW] | Brace and parenthesis match highlighting time, in milliseconds [Integer]. A hiliteMatchTime of 0 disables brace matching. |
hiliteStyles | [RW] | Array of hilite styles [an Array of FXHiliteStyle instances] |
hiliteTextColor | [RW] | Highlight text color [FXColor] |
length | [R] | The length of the text buffer [Integer] |
marginBottom | [RW] | Bottom margin [Integer] |
marginLeft | [RW] | Left margin [Integer] |
marginRight | [RW] | Right margin [Integer] |
marginTop | [RW] | Top margin [Integer] |
modified | [W] | Indicates whether text is modified [Boolean] |
numberColor | [RW] | Line number color [FXColor] |
selBackColor | [RW] | Selected text background color [FXColor] |
selEndPos | [R] | Selection end position [Integer] |
selStartPos | [R] | Selection start position [Integer] |
selTextColor | [RW] | Selected text color [FXColor] |
styled | [W] | Indicates whether text is styled [Boolean] |
tabColumns | [RW] | Tab columns [Integer] |
text | [RW] | The text buffer [String] |
textColor | [RW] | Text color [FXColor] |
textStyle | [RW] | Text widget style [Integer] |
tipText | [RW] | Tool tip message [String] |
visibleColumns | [RW] | Number of visible columns [Integer] |
visibleRows | [RW] | Number of visible rows [Integer] |
wrapColumns | [RW] | Wrap columns [Integer] |
Return an initialized FXText instance.
p: | the parent window for this text widget [FXComposite] |
target: | the message target, if any, for this text widget [FXObject] |
selector: | the message identifier for this text widget [Integer] |
opts: | text options [Integer] |
x: | initial x-position [Integer] |
y: | initial y-position [Integer] |
width: | initial width [Integer] |
height: | initial height [Integer] |
Append text to the end of the text buffer. If notify is true, SEL_INSERTED and SEL_CHANGED messages are sent to the text widget‘s message target after the new text is added.
Append text to the end of the text buffer. If notify is true, SEL_INSERTED and SEL_CHANGED messages are sent to the text widget‘s message target after the new text is added.
Change the style of text range at position pos in the text buffer to style. Here, style an array of bytes indicating the new style.
Change the style of n characters at position pos in the text buffer to style. Here, style is an integer index into the style table, indicating the new style for all the affected characters;
Extend selection to pos. If notify is true, a SEL_DESELECTED message is sent to the text widget‘s message target before any previously selected text is deselected, then a SEL_SELECTED message is sent after the new text is selected.
Search for string in text buffer, and return the extent of the string as a two-element array of arrays. The first array contains the beginning index (or indices) and the second array contains the ending index (or indices). The search starts from the given start position, scans forward (SEARCH_FORWARD) or backward (SEARCH_BACKWARD), and wraps around if SEARCH_WRAP has been specified. The search type is either a plain search (SEARCH_EXACT), case insensitive search (SEARCH_IGNORECASE), or regular expression search (SEARCH_REGEX).
Insert text at position pos in the text buffer. If notify is true, SEL_INSERTED and SEL_CHANGED messages are sent to the text widget‘s message target after the new text is inserted.
Insert text at position pos in the text buffer. If notify is true, SEL_INSERTED and SEL_CHANGED messages are sent to the text widget‘s message target after the new text is inserted.
Kill the selection. If notify is true, a SEL_DESELECTED message is sent to the text widget‘s message target before the text is deselected.
Remove n characters of text at position pos in the buffer If notify is true, a SEL_DELETED message is sent to the text widget‘s message target before the text is removed and a SEL_CHANGED message is sent after the change occurs.
Replace the m characters at pos with text. If notify is true, a SEL_DELETED message is sent to the text widget‘s message target before the old text is removed, and a SEL_INSERTED and SEL_CHANGED message is sent after the new text is inserted.
Replace the m characters at pos with text. If notify is true, a SEL_DELETED message is sent to the text widget‘s message target before the old text is removed, and a SEL_INSERTED and SEL_CHANGED message is sent after the new text is inserted.
Select all text. If notify is true, a SEL_DESELECTED message is sent to the text widget‘s message target before any previously selected text is deselected, then a SEL_SELECTED message is sent after the new text is selected.
Set cursor column. If notify is true, a SEL_CHANGED message is sent to the text widget‘s message target after the change occurs.
Set cursor position. If notify is true, a SEL_CHANGED message is sent to the text widget‘s message target after the change occurs.
Set cursor row. If notify is true, a SEL_CHANGED message is sent to the text widget‘s message target after the change occurs.
Select len characters starting at position pos. If notify is true, a SEL_DESELECTED message is sent to the text widget‘s message target before any previously selected text is deselected, then a SEL_SELECTED message is sent after the new text is selected.
Change the text If notify is true, SEL_INSERTED and SEL_CHANGED messages are sent to the text widget‘s message target after the new text is set.
Shift block of lines from position startPos up to endPos by given amount. If notify is true, a SEL_DELETED message is sent to the text widget‘s message target before the old text is removed, and a SEL_INSERTED and SEL_CHANGED message is sent after the new text is inserted.