#Click in Text Box
A hint:
The Text Box controls don't recognize mouse clicks. For example, if you
click the mouse on a new location in the control, the cursor moves there,
but nothing is updated, making it impossible to use the GetMessage API call
to determine the line number of the current line. There's an easy way to
fix this, however.
Put a timer on your form, then set the interval to 250 milliseconds, but
set Enabled to False.
In your Text Box control, set Timer1.enabled = -1 in the GotFocus event,
and to 0 in the LostFocus event.
Now, in the Timer control, insert this code in the Timer1.Timer event code
area:
SendKeys "+"
That's it. Now, whenever the Text control has the focus, the timer will
send a shift key every quarter of a second, updating the SelStart property,
thus letting your program know where the cursor is. I haven't had any
problem with this, but if the Shift key causes difficulties for you, try
some other non-printing keystroke.
George
There is 1 Reply.