Getting text line from textarea
BlitzMax Forums/BlitzMax Programming/Getting text line from textarea
| ||
| How do I get a string containing the current line in a textarea? Currently I can get the line the cursor is on, but I can't find a way to get the entire line of text which the cursor is in. Anyone? Edit: Found this http://www.blitzbasic.com/Community/posts.php?topic=56289&hl=TextArea%20line Example of getting entire line under cursor. Great for the syntax highlighting I'm working on :)
SuperStrict
Local MyWindow:TGadget=CreateWindow("TextArea Example", 40,40,400,400)
Global MyText:TGadget=CreateTextArea(0,0,380,360,MyWindow)
AddTextAreaText(MyText,"The Quick Brown Fox~n")
AddTextAreaText(MyText,"Jumps Over The Lazy Dog.")
Local cursorpos:Int
Repeat
WaitEvent()
Select EventID()
Case EVENT_WINDOWCLOSE
End
Case EVENT_GADGETSELECT
cursorpos=TextAreaCursor(MyText)
End Select
SetStatusText MyWindow, TextAreaText(MyText, TextAreaLine( MyText, cursorpos), 1, TEXTAREA_LINES)
Forever
End
|