• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 969
  • Last Modified:

How to get cursor position in a CRichEditCtrl

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
ble
Asked:
ble
1 Solution
 
KurtVonCommented:
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
 
bleAuthor Commented:
Yes, that did the trick. Thanks
0

Featured Post

Independent Software Vendors: 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!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now