You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 16, 2020. It is now read-only.
siegi44 edited this page Nov 21, 2007
·
6 revisions
Q: How can I access the currently selected text?
**A: ** For accessing the currently selected text you can either use the simple version or the more complicated version. The more complicated version has the advantage, that it can easily be expanded to multiple selections, which will be possible in future.
Simple: (assuming "textEditor1" is the name of your TextEditor control)
{{textEditor1.ActiveTextAreaControl.SelectionManager.SelectedText;}}
Improved:
{{<esc> TextArea textArea = textEditor1.ActiveTextAreaControl; // access the current text area. if (textArea.SelectionManager.HasSomethingSelected) { // if something is selected ISelection currentSelection = textArea.SelectionManager.SelectionCollection[0]; // Get the (first) selection string selectedText = currentSelection.SelectedText; // get the selected text. } </esc>}}
For more information about ISelection and SelectionManager see About selections.