Solved

How to get cursor position in a CRichEditCtrl

Posted on 2003-11-14
2
891 Views
Last Modified: 2013-11-20
I have a simple editor and I will show the current state of the text at the cursor position (e.g. show the right font and fontsize, set thet state of a bold/us/italic button). When I position the cursor somewhere in the text, I use GetSel to get the position of the cursor. However, this will return the previous position, not the current one? What have I done wrong?
0
Comment
Question by:ble
2 Comments
 
LVL 11

Accepted Solution

by:
KurtVon earned 125 total points
ID: 9747919
Are you checking teh position in OnLButtonDown, or OnLButtonUp?  It sounds liek you are getting teh position before the cursor has been moved.

Either way, you may want to try the EN_SELCHANGE notification instead.  It passes the new selection information to you.  http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/richedit/richeditcontrols/richeditcontrolreference/richeditnotificationmessages/en_selchange.asp

Hope this helps.
0
 

Author Comment

by:ble
ID: 9748281
Yes, that did the trick. Thanks
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying 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
Replacement selected text 2 63
difference between String.subString() and String.subSequence() 6 234
tripleUp challenge 7 86
Use of condition with 'serial' in ansible 2 70
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.

856 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