Solved

Cursor in richedit

Posted on 2000-04-26
1
406 Views
Last Modified: 2013-11-20
I am devloping a Editor whose view class is inherit by CRichEditView. I want to introduce bookmarks in my editor in the same way as done in VC++ IDE. My problem is that I want to set the cursor position after same spaces in RichEidt so that I can paste bookmark bmp at that place. Please reply
0
Comment
Question by:nabnof
[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
1 Comment
 

Accepted Solution

by:
appleby earned 25 total points
ID: 2760365
In your class derived from CRichEditView you can use this code to set your cursor position wherever you want it:

CRichEditCtrl& theCtrl = GetRichEditCtrl();
CHARRANGE crSel;

//if you need to find out the current cursor position            
theCtrl.GetSel(crSel);

//set up the charrange structure to the new location you want to move the
//cursor to.  Make the min and max positions the same to put the cursor at
//one position with nothing selected.
crSel.cpMin = crSel.cpMin + 4; //for example to move it 4 characters over
crSel.cpMax = crSel.cpMin; //want nothing selected, so same as min.
            theCtrl.SetSel(crSel); //sets the cursor to the location you
// just defined.
0

Featured Post

Database Solutions Engineer FAQs

In this series, we will discuss common questions received as a database Solutions Engineer at Percona. In this role, we speak with a wide array of MySQL and MongoDB users responsible for both extremely large and complex environments to smaller single-server environments.

Question has a verified solution.

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

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
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.
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

622 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