The KeyWords are: TextArea_Lines and TextArea_Chars
Small Sample:
' createtextarea.bmx
Strict
Local window:TGadget
Local textarea:TGadget
Local TextBox:TGadget
window=CreateWindow("My Window",130,20,200,200,,15|WINDOW_ACCEPTFILES)
textarea=CreateTextArea(0,0,ClientWidth(window),ClientHeight(window)/2,window)
SetGadgetLayout textarea,1,1,1,1
SetGadgetText textarea,"a textarea gadget~none line~nandanother"
ActivateGadget textarea
Textbox = CreateTextField(0,ClientHeight(window)/2+10,ClientWidth(window),20,window)
While WaitEvent()
Print CurrentEvent.ToString()+" "+EventSourceHandle()
Select EventID()
Case EVENT_WINDOWCLOSE
End
Case EVENT_APPTERMINATE
End
Case EVENT_GADGETSELECT
Select EventSource()
Case textarea
Local Line:Int = TextAreaCursor(textarea,TEXTAREA_LINES)
TextBox.SetText(TextAreaText(textArea,line,1,TEXTAREA_LINES).Trim())
End Select
End Select
Wend
TextArea_Lines --> Will always give something back with lines. For example TextAreaCursor(textarea,TEXTAREA_LINES) will return the current line in which the cursor is. TextAreaCursor(textarea,TEXTAREA_CHARS) will return the correct Cursorposition related to the chars in the text.
So if you use TextAreaText with TEXTAREA_LINES and a length of 1 then the position means the line you want and TextAreaText will return the text of the desired line.
|