Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What is the Cursorposition ? 2

Status
Not open for further replies.

KoenPiller

Programmer
Apr 4, 2001
270
NL
Hi,
I need a function for VFP 6.0 which tells me at which position the cursor is in a textbox.
To determine the exact position you can count the KeyStrokes, but howabout when a user clicks somewhere in the textbox with his mouse to change that letter? I have tried to use the SUBSTR() but cant find a workable solution. Is there a solution for this?
Thanks,
Koen
 
Chris,

To track the exact position of the Mouse is a solution, will try this however have my doubts since the position of the mouse is not determined by the number of letters only it varies with the total with of preceeding letters. Cursor at position 5 in the word Mimmic is sureley different from the position 5th in the word Itilac. How to overcome?, more over useres are free to change font in this textbox.

Koen
 
Hi KoenPiller

If you don't mind some "dirty" programming try this:
Code:
ThisForm.txtYourTextbox.SetFocus && if you are not there at the moment
KEYBOARD '{SHIFT+HOME}'          && select everything to the left from cursor
DOEVENTS                         && let the kbd work
lnCurPoz = ThisForm.txtYourTextbox.seltext  && this is the position you wanted to know
                                  && discard selection (for your homework )

Bye Tom
 
Without women, what the world would be ...
Thanks Marcia
Tom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top