Solved

How to get cursor position in a CRichEditCtrl

Posted on 2003-11-14
2
871 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
xyBalance chalenge 58 88
Perl Awk Need Help 3 95
maven archtype selection in eclipse 1 51
VBA "SendKeys" Syntax for Multiple Keystrokes 7 98
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
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.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

744 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now