@js
RichText is used to view and edit text styled with different fonts and colors.
Slots
- hbarSource
-
readonly ScrollBar hbar
Horizontal scroll bar.
- makeSource
-
new make(|RichText|? f := null)
Default constructor.
- modelSource
-
RichTextModel? model
Backing data model of text document. The model cannot be changed once the widget has been been mounted into an open window.
- modifySource
-
override Void modify(Int start, Int replaceLen, Str newText)
Overrides fwt::TextWidget.modify
Convenience for
RichTextModel.modify
. - offsetAtPosSource
-
native Int? offsetAtPos(Int x, Int y)
Map a coordinate on the widget to an offset in the text, or return null if no mapping at specified point.
- onCaretSource
-
@transient
readonly EventListeners onCaret := EventListeners()Callback when the caret position is modified.
Event id fired:
Event fields:
Event.offset
: the new caret offset
-
private |Event| onModelModifyFunc := |Obj?->Void| { ... }
- onModifySource
-
@transient
readonly EventListeners onModify := EventListeners()Callback when the text is modified. This event occurs after the modification. See onVerify to trap changes before they occur.
Event id fired:
Event fields:
Event.data
: theTextChange
instance.
- onSelectSource
-
@transient
readonly EventListeners onSelect := EventListeners()Callback when the selection is modified.
Event id fired:
Event fields:
Event.offset
: the starting offsetEvent.size
: the number of chars selected
- onVerifySource
-
@transient
readonly EventListeners onVerify := EventListeners()Callback before the text is modified. This gives listeners a chance to intercept modifications and potentially modify the inserted text. This event occurs before the modification. See onModify to trap changes after they occur.
Event id fired:
Event fields:
Event.data
: aTextChange
instance wherenewText
specifies the proposed text being inserted. The callback can updatenewText
with the actual text to be inserted or set to null to cancel the modification.
- onVerifyKeySource
-
@transient
readonly EventListeners onVerifyKey := EventListeners()Callback before a key event is processed. This gives listeners a chance to trap the key event and
consume
it before it is processed by the editor.Event id fired:
Event fields:
Event.keyChar
: unicode character represented by key eventEvent.key
: key code including the modifiers
- repaintLineSource
-
Void repaintLine(Int lineIndex)
Repaint the line specified by the zero based line index.
- repaintRangeSource
-
native Void repaintRange(Int offset, Int len)
Repaint the specified text range.
- showLineSource
-
native Void showLine(Int lineIndex)
Ensure the editor is scrolled such that the specified line is visible.
- tabSpacingSource
-
native Int tabSpacing
Tab width measured in space characters. Default is 2.
- textSource
-
override Str text
Overrides fwt::TextWidget.text
Convenience for
model.text
(model must be installed). - topLineSource
-
virtual native Int topLine
The zero based line index which is currently at the top of the scrolling viewport.
- vbarSource
-
readonly ScrollBar vbar
Vertical scroll bar.