Position cursor within textbox
Posted: Wed Aug 07, 2019 1:20 pm
I wish to be able to display text in a textbox, and then position the cursor at the end of the that text, so that any further text entered by the user would then be added at the end.
Support forum for LB Booster (LBB)
I'm sure it's quite straightforward using an API call (EM_SETSEL is the message you need), and somewhere I've got the code to do it. Unfortunately I'm bogged down with other things at the moment and cannot instantly find it.
Code: Select all
'Place text in textbox and locate 'caret at end of text. nomainwin textbox #1.t, 10,10,100,124 Open "Type" for window as #1 #1 "trapclose [quit]" #1.t "!setfocus" #1.t "Hello World" startpos=len("Hello World") endpos=startpos hText=hwnd(#1.t) calldll #user32, "SendMessageA",_ hText as ulong,_EM_SETSEL as long,_ startpos as long, endpos as long,_ re as long wait [quit] close #1:end