Re: CEdit, set cursor position

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Joseph M. Newcomer (newcomer_at_flounder.com)
Date: 09/02/04


Date: Thu, 02 Sep 2004 12:22:39 -0400

If the selection start and end are the same, you see no selection, you just get the caret.

Set the selection in the OnSetActive handler. You also need to set the focus first.
                                        joe

On Thu, 2 Sep 2004 07:19:09 -0700, Jon Evans <JonEvans@discussions.microsoft.com> wrote:

>How do you set the cursor position in a CEdit control ?
>
>Reading back through previous threads seems to indicate
>that you somehow use CEdit's SetSel(). Can anyone tell me
>what parameters to pass ? I want the cursor to be at the right
>of any text and with no text highlighted.
>
>If I have just used CEdit's SetWindowText() and then
>called SetSel(1000,1000) (1000 being much greater
>than text length) then this appears to work.
>
>However the CEdit resides on a property page used as
>a wizard, and I'm finding it impossible to control the CEdit
>when people arrive on the page from another page's 'back'
>or 'next' button. I can get the cursor to the end of the text
>but the blasted text is still highlighted :-(
>
>Before I completely loose the plot and try sending virtual
>right key presses to the control, can anyone suggest how
>to do it properly ?
>
>TTFN,
> Jon

Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm


Quantcast