Xbasic

TEXT.GET_CURSOR Function

Syntax

CursorPosition as N = VariableName.OBJECT.GET_CURSOR()

Description

The OBJECT.GET_CURSOR() method is used with an Xdialog text control. It returns 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
if a_dlg_button = "paste" then
    a_dlg_button = ""
    'get the current insertion point
    ip = ptext.object.get_cursor()
    new_ip = ip + len(ClipBoard.Get_Data())
    ptext.object.paste()
    'after clicking the 'paste' button focus is on the button. we want to return focus to the edit control
    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

Limitations

Desktop applications only.

See Also