formadmirer
asked on
Text Insert with VFP 9
Hi all. I've been trying to get insertion to work within a text box, so that user input text will be inserted at the current cursor position.
For example we have two textboxes. Textbox 1 is pulled from a db and contains the string "This is what is all about"
Textbox 2 allows user input and the user types the word 'life'
User clicks within textbox 1 to set the cursor position after the word 'what'
By clicking a command button, I would like 'life' to be inserted at the current cursor position, to make the sentence read "This is what life is all about."
This is just an example as the actual text lengths will vary in use.
I've been working with SelStart and I can get the text inserted at the end of the sentence, but not within the body of it. Can someone please help?
For example we have two textboxes. Textbox 1 is pulled from a db and contains the string "This is what is all about"
Textbox 2 allows user input and the user types the word 'life'
User clicks within textbox 1 to set the cursor position after the word 'what'
By clicking a command button, I would like 'life' to be inserted at the current cursor position, to make the sentence read "This is what life is all about."
This is just an example as the actual text lengths will vary in use.
I've been working with SelStart and I can get the text inserted at the end of the sentence, but not within the body of it. Can someone please help?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks all - got it using a conglomeration of SUBSTR and LENs
Points for taking the time to help - I do appreciate it.
Points for taking the time to help - I do appreciate it.
ASKER
I ended up getting this on my own - no fault of the experts - it's just I was working as I posted and eventually got it.
to move cursor use
ThisForm.txtBox1.SelStart =len(alltrim(ThisForm.txtB ox1.value) )
ThisForm.txtBox1.SelStart =len(alltrim(ThisForm.txtB
ASKER
The only thing is it needs to advance the cursor to the end of the entire text so the user can continue typing.
Any idea how to insert the cursor - or advance the cursor - to a predetermined point?