Move to end of edit box - Programmer

This is a discussion on Move to end of edit box - Programmer ; 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 ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: Move to end of edit box

  1. Move to end of edit box

    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?

    --
    Steve Wolstenholme Neural Planner Software

    EasyNN-plus. The easy way to build neural networks.
    http://www.easynn.com

  2. Re: Move to end of edit box

    >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?


    Use SetSel.

    CEdit * pEdit = ... get the edit control...

    /* Force no selection with the caret at the end */
    pEdit->SetSel( -1, -1 );

    Dave

  3. Re: Move to end of edit box

    On Sun, 18 Jun 2006 22:04:03 +0100, David Lowndes
    wrote:

    >>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?

    >
    >Use SetSel.
    >
    > CEdit * pEdit = ... get the edit control...
    >
    > /* Force no selection with the caret at the end */
    > pEdit->SetSel( -1, -1 );
    >
    >Dave


    How do I get the edit control?

    Steve

  4. 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

    steve@tropheus.demon.co.uk wrote:
    > On Sun, 18 Jun 2006 22:04:03 +0100, David Lowndes
    > wrote:
    >
    > >>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?

    > >
    > >Use SetSel.
    > >
    > > CEdit * pEdit = ... get the edit control...
    > >
    > > /* Force no selection with the caret at the end */
    > > pEdit->SetSel( -1, -1 );
    > >
    > >Dave

    >
    > How do I get the edit control?
    >
    > Steve



+ Reply to Thread