Hanqian
asked on
How to control cursor and backspac's position in edit control?
I have an edit control, how I set the cursor to the position that I want within this control, for example, after I type two characters, I don't want the cursor stay at third position instead I want the cursor jump to the fouth position. The same thing for "back space" key, if there is a text in control, and I used this key to delete from the end of text, but I don't want to delete a special character in this text, how to let "back space" jump over from this character to next character.
Thanks.
Hanqian
Thanks.
Hanqian
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I assume your control is empty when you start typing.
You would need to add the third (space) character yourself then position at the end (4th) position.
You would need to add the third (space) character yourself then position at the end (4th) position.
ASKER
I did add "/" at third position.
Hanqian
Hanqian
If edit control has 3 characters, you can write:
pEdit->SetSel(3, 3);
4 is still out of range.
pEdit->SetSel(3, 3);
4 is still out of range.
ASKER
That means that we can't use SetSel() to set the cursor at the blank position of the edit control.
Hanqian
Hanqian
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hanqian