Getting cursor highlighted text from a txtarea

BlitzPlus Forums/BlitzPlus Programming/Getting cursor highlighted text from a txtarea

code(Posted 2004) [#1]
Well how would I get the text that the user has highlight with the cursor? txtareacursor(textarea,1) doesn't do it


MattVonFat(Posted 2004) [#2]
This seems to work for me:

w = CreateWindow("", 0, 0, 500, 400, 0, 1)
txt = CreateTextArea(0, 0, 500, 300, w)
button = CreateButton("Selected Text", 150, 330, 100, 40, w)

While WaitEvent() <> $803

	If EventID() = $401
		If EventSource() = button
			
			temp$ = TextAreaText(txt)
			pos% = TextAreaCursor(txt)
			length% = TextAreaSelLen(txt)
			
			selectedText$ = Mid(temp$, pos%+1, length%)
			
			Notify selectedText$
			
		End If
	End If
	
Wend