Share this page

# sapgui_text_edit_set_selection_indexes

Text Edit Control Functions

Sets the visually selected text range.

    int sapgui_text_edit_set_selection_indexes( const char *description, const char *textEditID, const char *startNumber, const char *endNumber, [args,]  LAST );

description | User entered text to aid in understanding script
textEditID | Object ID Strings
startNumber | The zero-based position of the first character in the selection
endNumber | The zero-based position of the first character after the end of the selection
args | Optional Arguments
LAST | A marker indicating the end of the argument list. Not required if Optional Arguments are used.

sapgui_text_edit_set_selection_indexes sets the visually selected text range. Arguments startNumber and endNumber are zero based character indexes. startNumber corresponds to the position where the selection begins and endNumber is the position of the first character following the selection.

Setting startNumber equal to endNumber results in setting the cursor at this position.

If startNumber is past the end of the text, it is set to the last position in the text. If endNumber is past the end of the text, it is set to one character past the end of the text. If both startNumber and endNumber are past the end of the text, they are set to the last position in the text.

In all cases of arguments past the end of the text, the log for this function reports the values of the arguments as passed to the function. However, sapgui_text_edit_get_selection_index_start and sapgui_text_edit_get_selection_index_end report the actual selected positions.

## Return Values

This function returns LR_PASS (0) on success or LR_FAIL (1) on failure.

## Parameterization

You can parameterize all string (char type) arguments.

## Example

This example shows the selection of the first five characters in the text edit control. Note that the end parameter is the index of the first character after the selection, so characters 0 to 4 are selected when the end parameter is 5.

Copy code

    sapgui_text_edit_set_selection_indexes(
        "Set range",
        "usr/cntlSRC/shellcont/shell",
        "0",
        "5",
        LAST );

Tips to improve your search results... VuGen Function Reference Version 26.1-26.3 Function Reference 26.1-26.3 All View Local Help Center View Online Help Center Version: