CompuServe Thread

#Click in Text Box

2 messages in this thread
#2003From: George CampbellOct 8, 1991 9:04 AM
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.
#2110From: George CampbellOct 8, 1991 8:05 PM
OOPS! My mistake. The Shift key is a lousy choice, as I found out today. But you know what works? {SCROLLLOCK}. Notice that there are three Ls, not the two shown in the Language Reference. George