Position cursor within textbox
Position cursor within textbox
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.
Re: Position cursor within textbox
I should have added that I have no problem with the display aspect, as I have been using LBB for years, and have developed a number of commercial programs. It is merely the cursor placement I am interested in, analagous to the texteditor command - print #handle, "!select column row" ;
I am not aware of such a command for a textbox
I am not aware of such a command for a textbox
Re: Position cursor within textbox
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.
-
- Posts: 37
- Joined: Fri Apr 06, 2018 6:27 am
Re: Position cursor within textbox
Richard,
Thank you, Here is the code,
Regards
Thank you, Here is the code,
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
Re: Position cursor within textbox
To Sarmednafi
Thanks very much
That works great
Regards
Dermot
Thanks very much
That works great
Regards
Dermot