Livecode Wiki

Returns a chunk expression describing the location of the text selection or insertion point (or caret or cursor).




the selectedChunk
put the selectedChunk into storedChunk

Use the selectedChunk function to determine which text is selected.

The return value reports the selected text: the startChar is the first character of the selection, and the endChar is the last character.

If no text is selected but the text insertion point is in a field, the startChar is the character after the insertion point, and the endChar is the character before the insertion point. In this case, the endChar is one less than the startChar.

#Example of selected text:
char 4 to 8 of field 1

#Example of NOT selected text, just blinking cursor: 
char 5 to 4 of field 1

If there is no insertion point or text selection, the selectedChunk function returns empty.

To get actual text that is selected, use the selectedText function.

See also: selectedField (function), selectedLine (function), selectedLoc (function), foundChunk (function), clickChunk (function), mouseChunk (function), selected (property), select