Link to home
Start Free TrialLog in
Avatar of chhakuli
chhakuli

asked on

caret index in CRichEditCtrl

How can I get the current character index, i.e., the index of the caret in CRichEditCtrl? There are functions to get current line index, no of lines but I do not find one to get caret index. Any help?
Avatar of DanRollins
DanRollins
Flag of United States of America image

Use GetSel:

long nStartPose, nEndPos;
m_ctlRichEd.void GetSel( nStartPos, nEndPos );

if ( nStartPos == nEndPos } {
        MessageBox("There no selection, only a caret");
} else {
        MessageBox("some text is selected");
}

-- Dan

ASKER CERTIFIED SOLUTION
Avatar of pagladasu
pagladasu

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Excellent observation pagladasu! I wish I'd said that!
-- Dan
One typo.  Use:

m_ctlRichEd.GetSel( nStartPos, nEndPos );


chhakuli,

Why did you accept pagladasus'c comment as the answer?  It is very obviously a copy of my comment.  It even has the exact same typographical error!

-- Dan
Avatar of pagladasu
pagladasu

U are right, DanRollins. I just made an observation on your comment based on the question. I think u should get the points.
This was the result of a database error, and points may not have properly gone to you .  Can you check for us?

We may need to do this question again if you can't see the points.

Moondancer - EE Moderator