Re: Move to end of edit box
>I have an edit box in a grid edit dialog that opens when I type a[color=blue]
>single character.
>
>if(nChar > 0)
> dlgGrid.m_strEditCell = (TCHAR)nChar;
>
>The character is selected but I want to deselect it and position the
>caret after the character. How do I do that?[/color]
Use SetSel.
CEdit * pEdit = ... get the edit control...
/* Force no selection with the caret at the end */
pEdit->SetSel( -1, -1 );
Dave
Re: Move to end of edit box
On Sun, 18 Jun 2006 22:04:03 +0100, David Lowndes
<DavidL@example.invalid> wrote:
[color=blue][color=green]
>>I have an edit box in a grid edit dialog that opens when I type a
>>single character.
>>
>>if(nChar > 0)
>> dlgGrid.m_strEditCell = (TCHAR)nChar;
>>
>>The character is selected but I want to deselect it and position the
>>caret after the character. How do I do that?[/color]
>
>Use SetSel.
>
> CEdit * pEdit = ... get the edit control...
>
> /* Force no selection with the caret at the end */
> pEdit->SetSel( -1, -1 );
>
>Dave[/color]
How do I get the edit control?
Steve
Re: Move to end of edit box
Hi Steve,
Use SetSel to set the caret position.You can get edit control in the
dialog using GetDlgItem function which takes control id as the
parameter.
-Kiran
[email]steve@tropheus.demon.co.uk[/email] wrote:[color=blue]
> On Sun, 18 Jun 2006 22:04:03 +0100, David Lowndes
> <DavidL@example.invalid> wrote:
>[color=green][color=darkred]
> >>I have an edit box in a grid edit dialog that opens when I type a
> >>single character.
> >>
> >>if(nChar > 0)
> >> dlgGrid.m_strEditCell = (TCHAR)nChar;
> >>
> >>The character is selected but I want to deselect it and position the
> >>caret after the character. How do I do that?[/color]
> >
> >Use SetSel.
> >
> > CEdit * pEdit = ... get the edit control...
> >
> > /* Force no selection with the caret at the end */
> > pEdit->SetSel( -1, -1 );
> >
> >Dave[/color]
>
> How do I get the edit control?
>
> Steve[/color]