Click here to Skip to main content
15,917,533 members

Comments by pokider (Top 2 by date)

pokider 6-Dec-11 9:05am View    
Deleted
Ah ok, they want the line and the index of chars in the line as a position. But as I said before, the selection start is not necessarily the index of the cursor.
pokider 6-Dec-11 7:06am View    
Deleted
It's even easier: TextBox.GetPositionFromCharIndex(TextBox.SelectionStart);

But this is also not correct. The SelectionStart is the Index from Char where the selection is starting, but not the Caret Index. When I selected text over two lines, is the selection start in Line one, but the caret is in line two. In this example is the caret index selection start + selection length.
Provided the selection started from left to right, because the selection start is the first Index the selection.
I don't know how can I determine the current index. (I'm on despair)