Navigating Textarea. How do you move to a line?
BlitzPlus Forums/BlitzPlus Programming/Navigating Textarea. How do you move to a line?
| ||
| I need to be able to move to any line in a TextArea and have the textarea slider/view update to that new location. Just like when you click on a Function name in your Blitz IDE and the editor moves to that location. I've tried SetTextAreaText with no luck. Any Ideas? Thanks, |
| ||
Use SendMessage EM_SETSEL. Example:
; .lib "user32.dll"
; SendMessage%(hwnd%, wMsg%, wParam%, lParam%):"SendMessageA"
Const EM_SETSEL = 177
wndMain=CreateWindow("",200,200,200,200)
tarMain=CreateTextArea(0,0,100,100,wndMain)
lblMain=CreateLabel("Cursor pos: ",0,105,100,20,wndMain)
btnMain=CreateButton("Move Cursor",105,0,80,20,wndMain)
SetTextAreaText(tarMain, "Text Area Text Area Text")
Repeat
Select WaitEvent()
Case $803 : End
Case $401
Select EventSource()
Case tarMain
SetGadgetText(lblMain, "Cursor pos: " + TextAreaCursor(tarMain))
Case btnMain
SendMessage(QueryObject(tarMain,1), EM_SETSEL, 1, 1)
ActivateGadget(tarMain)
SetGadgetText(lblMain, "Cursor pos: " + TextAreaCursor(tarMain))
End Select
End Select
Forever
|
| ||
| @Soja Most Excellent! That works very well. :) Do you have any others? Like "Lock Text Area" (b+ Lock Text borken). I'll look through the forms for more. Anyway.. Thanks |
| ||
| Hrmmm.. I'm not sure what Lock Text Area means. You can look on msdn.microsoft.com, under (let's see if I remember right) User Interface->Controls->Individual Controls->Edit Controls->Edit Controls Reference->Messages to see a list of edit control (textarea) messages. |