how to setFocus to the text field?


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 6 of 6

Thread: how to setFocus to the text field?

  1. #1
    Ramana Guest

    how to setFocus to the text field?


    Dear All,
    how to set the Focus to the text field, when dialog open?

    thank you
    ramana

  2. #2
    Sheshadri Iyengar Guest

    Re: how to setFocus to the text field?

    For ex.

    CEditBox* edit = (CEditBox*)GetDlgItem(ID_EDIT_BOX);
    edit->SetFocus();

    Put this code as part of the OnInitDialog function.

    shesh

    Ramana wrote:

    > Dear All,
    > how to set the Focus to the text field, when dialog open?
    >
    > thank you
    > ramana





  3. #3
    Ramana Guest

    Re: how to setFocus to the text field?


    Dear sir,
    we have written like as follows
    CEdit* edit = (CEdit*)GetDlgItem(IDC_EDIT1);
    edit->SetFocus();
    i kept in OnInitDialog function.
    BUT in MFC CEditBox is not available , its giving error "undeclared variable".

    thank you
    ramana

    Sheshadri Iyengar <sheshadri.i@kshema.com> wrote:
    >For ex.
    >
    >CEditBox* edit = (CEditBox*)GetDlgItem(ID_EDIT_BOX);
    >edit->SetFocus();
    >
    >Put this code as part of the OnInitDialog function.
    >
    >shesh
    >
    >Ramana wrote:
    >
    >> Dear All,
    >> how to set the Focus to the text field, when dialog open?
    >>
    >> thank you
    >> ramana

    >
    >
    >



  4. #4
    Sheshadri Iyengar Guest

    Re: how to setFocus to the text field?

    sorry ... it is CEdit only, the CEditBox doesn't exist in MFC.

    thank you
    shesh

    Ramana wrote:

    > Dear sir,
    > we have written like as follows
    > CEdit* edit = (CEdit*)GetDlgItem(IDC_EDIT1);
    > edit->SetFocus();
    > i kept in OnInitDialog function.
    > BUT in MFC CEditBox is not available , its giving error "undeclared variable".
    >
    > thank you
    > ramana
    >
    > Sheshadri Iyengar <sheshadri.i@kshema.com> wrote:
    > >For ex.
    > >
    > >CEditBox* edit = (CEditBox*)GetDlgItem(ID_EDIT_BOX);
    > >edit->SetFocus();
    > >
    > >Put this code as part of the OnInitDialog function.
    > >
    > >shesh
    > >
    > >Ramana wrote:
    > >
    > >> Dear All,
    > >> how to set the Focus to the text field, when dialog open?
    > >>
    > >> thank you
    > >> ramana

    > >
    > >
    > >





  5. #5
    August Guest

    Re: how to setFocus to the text field?


    I've seen this before, I think the trick is to set the focus to a text label
    just prior (by tab order) to the edit control. I can look it up tonight
    if this didn't provide enough of a hint, just let me know.

    August

    Sheshadri Iyengar <sheshadri.i@kshema.com> wrote:
    >sorry ... it is CEdit only, the CEditBox doesn't exist in MFC.
    >
    >thank you
    >shesh
    >
    >Ramana wrote:
    >
    >> Dear sir,
    >> we have written like as follows
    >> CEdit* edit = (CEdit*)GetDlgItem(IDC_EDIT1);
    >> edit->SetFocus();
    >> i kept in OnInitDialog function.
    >> BUT in MFC CEditBox is not available , its giving error "undeclared variable".
    >>
    >> thank you
    >> ramana
    >>
    >> Sheshadri Iyengar <sheshadri.i@kshema.com> wrote:
    >> >For ex.
    >> >
    >> >CEditBox* edit = (CEditBox*)GetDlgItem(ID_EDIT_BOX);
    >> >edit->SetFocus();
    >> >
    >> >Put this code as part of the OnInitDialog function.
    >> >
    >> >shesh
    >> >
    >> >Ramana wrote:
    >> >
    >> >> Dear All,
    >> >> how to set the Focus to the text field, when dialog open?
    >> >>
    >> >> thank you
    >> >> ramana
    >> >
    >> >
    >> >

    >
    >
    >



  6. #6
    Ramana Guest

    Re: how to setFocus to the text field?


    Dear All,

    WE got the solution with the following code :

    CEdit* edit = (CEdit*)GetDlgItem(IDC_EDIT1);
    edit->SetFocus();
    Return FALSE;


    thank you verymuch
    Ramana


    "August" <ColdCuts@mac.com> wrote:
    >
    >I've seen this before, I think the trick is to set the focus to a text label
    >just prior (by tab order) to the edit control. I can look it up tonight
    >if this didn't provide enough of a hint, just let me know.
    >
    >August
    >
    >Sheshadri Iyengar <sheshadri.i@kshema.com> wrote:
    >>sorry ... it is CEdit only, the CEditBox doesn't exist in MFC.
    >>
    >>thank you
    >>shesh
    >>
    >>Ramana wrote:
    >>
    >>> Dear sir,
    >>> we have written like as follows
    >>> CEdit* edit = (CEdit*)GetDlgItem(IDC_EDIT1);
    >>> edit->SetFocus();
    >>> i kept in OnInitDialog function.
    >>> BUT in MFC CEditBox is not available , its giving error "undeclared variable".
    >>>
    >>> thank you
    >>> ramana
    >>>
    >>> Sheshadri Iyengar <sheshadri.i@kshema.com> wrote:
    >>> >For ex.
    >>> >
    >>> >CEditBox* edit = (CEditBox*)GetDlgItem(ID_EDIT_BOX);
    >>> >edit->SetFocus();
    >>> >
    >>> >Put this code as part of the OnInitDialog function.
    >>> >
    >>> >shesh
    >>> >
    >>> >Ramana wrote:
    >>> >
    >>> >> Dear All,
    >>> >> how to set the Focus to the text field, when dialog open?
    >>> >>
    >>> >> thank you
    >>> >> ramana
    >>> >
    >>> >
    >>> >

    >>
    >>
    >>

    >



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center