Shiny Language Reference
Language Reference > User Interface > Memo Boxes
getmemoboxselcount
int getmemoboxselcount(int ID);
Returns the number of selected characters in a selection range
The GETMEMOBOXSELCOUNT statement returns the number of characters selected in a memobox. Characters are selected by holding down the shift key and using the arrow keys to move the caret. This statement is designed to be used with the getmemoboxselstart statement, allowing you to extract the currently selected text. The most common use of these statements is with the memoboxgetat statement, to retrieve the currently selected text.
Parameters
ID
The control ID of the control you wish to retrieve the selection count for
Return Value
The number of characters selected, or -1 if no selection is currently in effect.
Example Code
// Create the memo box X: 10, Y:10 and sized 150*70
int iMemoBoxID = creatememobox(1, 10, 10, 150, 70);
// Set the memobox text to "Hello World"
setcaption(iMemoBoxID, "Hello World");
// At this point we assume the user has selected some text
// Retrieve the current selection
int iFirstSelPos = getmemoboxselstart(iMemoBoxID);
// Retrieve the number of characters selected
int iSelectionCount = getmemoboxselcount(iMemoBoxID);