- Home /
Moving Cursor position in a TextField/Area.
Hello, im trying to replace 1 character with 2 new ones and this results in the cursor being inbetween the 2 new characters.
stringToEdit = stringToEdit.Replace("A","BB");
Is there a workaround or solution so i can type without placing the cursor in the front manually?
Answer by Eno-Khaon · Nov 10, 2015 at 11:17 AM
This might not be elegant, but it might be something to try experimenting with a little bit.
TextEditor txt = (TextEditor)GUIUtility.GetStateObject(typeof(TextEditor), GUIUtility.keyboardControl);
txt.cursorIndex += 1;
I can't guarantee perfection from this, but if nothing else, hopefully it's at least a good lead to start from.
$$anonymous$$Ight seem stupid, but how do i implement this?
Your answer
Follow this Question
Related Questions
SOLVED - String replace % with " in C# 1 Answer
How can I convert UTF8 string to arabic? 2 Answers
How to define in which text field the cursors is located 2 Answers
move character towards the mouse on click 2 Answers
Replace chars in String with a Dictionary and avoid order-sensitive problems 0 Answers