Skip to content

SelText - DfBaseRichEdit

Returns selected text

Type: Function
Return Data Type: string

Syntax

Function SelText Returns string

Call Example

Get SelText to stringVariable

Description

Returns the selected text of the control.

This method has no effect if control is not paged.

Sample

This sample gets the selected text of the oRichEdit1 control to variable sSelectedText and then displays it to the user in a message box.

Procedure ShowSelectedText
    string sSelectedText

    get SelText of oRichEdit1 to sSelectedText

    send Info_Box sSelectedText "Selected Text"
End_Procedure // ShowSelectedText

This class does not have an insert function, but we can easily add one:

Procedure Insert String sInsertText
    Integer iPos
    String sText

    Get SelStart to iPos
    Send SetSel iPos -1
    Get SelText to sText
    Move (sInsertText + sText) to sText
    Send ReplaceSel sText
End_Procedure

It can be called like this:

Procedure OnClick
    String sText

    Get Value of oInsertTextForm to sText
    Send Insert of oTextEditor sText
End_Procedure

Return Value

Selected text of the control.