Xbasic

TEXT.INSERT_TEXT Function

Syntax

VariableName.OBJECT.INSERT_TEXT( TextString as C )

Description

The OBJECT.INSERT_TEXT() method is used with an Xdialog text control. It inserts the TextString at the position of the cursor in the VariableName text variable.

Example 

dim ptext as P
dim ptext.text as C
dim ptext.object as P
dim ip as N
dim new_ip as N
dim string as C
if a_dlg_button = "insert" then
    a_dlg_button = ""
    string = "text to insert"
    flag_ok = .f.
    ui_dlg_box("Highlight String","String |[.25string];{lf};| ",<<%txt%
    if a_dlg_button = "ok" then
        flag_ok = .t.
    end if
%txt%)
    if flag_ok = .t. then
        ip = ptext.object.get_cursor()
        new_ip = ip + len(string)
        ptext.object.insert_text(string)
        ui_dlg_ctl_goto(dlg_title,"ptext")
        ptext.object.set_cursor(new_ip)
        'this causes the text box to scroll if the insertion point is not currently visible
        ptext.object.show_caret()
    end if
end if

Limitations

Desktop applications only.

See Also