Solved

caret index in CRichEditCtrl

Posted on 2002-04-01
7
494 Views
Last Modified: 2013-11-20
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?
0
Comment
Question by:chhakuli
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
7 Comments
 
LVL 49

Expert Comment

by:DanRollins
ID: 6910904
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

0
 
LVL 4

Accepted Solution

by:
pagladasu earned 0 total points
ID: 6911246
Use
m_ctlRichEd.void GetSel( nStartPos, nEndPos );
if the values of nStartPos and nEndPos are both equal, then nStartPos or nEndPos will give you 'the index of the caret in CRichEditCtrl'.
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 6911278
Excellent observation pagladasu! I wish I'd said that!
-- Dan
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 49

Expert Comment

by:DanRollins
ID: 6911279
One typo.  Use:

m_ctlRichEd.GetSel( nStartPos, nEndPos );


0
 
LVL 49

Expert Comment

by:DanRollins
ID: 6913920
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
0
 
LVL 4

Expert Comment

by:pagladasu
ID: 6913945
U are right, DanRollins. I just made an observation on your comment based on the question. I think u should get the points.
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6914337
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
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
deburging in oracle form 12 119
Looking for a specific application/software 2 124
while loop over for loop 7 119
Excel file not created as expected 7 110
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
In this post we will learn different types of Android Layout and some basics of an Android App.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question