CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8
  1. #1
    Guest

    Setting Focus or Active?

    I am curious how I would make a combobox in a tool/dialog bar active when program is to a complete start up state, in other words after all are created and basic initializations are done, I would like to set a specifice control as the active one?

    My initial thoughts proved to unsucsessful so I am looking for help out here.

    Thanks in advance
    Shawn
    [email protected]


  2. #2
    Join Date
    May 1999
    Location
    Houston - TX - US
    Posts
    29

    Re: Setting Focus or Active?

    Hi ,
    use CWnd::SetFocus .
    Good Luck.
    Yash.


  3. #3
    Guest

    Re: Setting Focus or Active?

    but where? every place I have tried doesn't produce desired result.


  4. #4
    Join Date
    May 1999
    Posts
    31

    Re: Setting Focus or Active?

    Hi,

    You have to put the call in the OnInitDialog member of your dialog class. Also, make sure to return FALSE, to indicate that you have set the focus to a control.

    Daniel.


  5. #5
    Join Date
    May 1999
    Location
    Sydney, Australia
    Posts
    420

    Re: Setting Focus or Active?


    When you create the control remember its window pointer
    and then at the end of starting the program POST yourself a message
    and in that message handler, set focus to the control

    Sally


  6. #6
    Guest

    Re: Setting Focus or Active?

    put it at the end of the oninitdilaog initially. But take care that after this if U set any modify any other controls , ur set focus is lost .Can U give ur piece of code so that someone can suggest better ???

    Yash.


  7. #7
    Guest

    Re: Setting Focus or Active?

    in the main frame I create a CSizingControlBar(code I got from docking window section of this site) derived class, where in the MainFrame::OnCreate I activate.

    In that derived class I have a CComboBox which I create and activate in the derived class' OnCreate(). It is this ComboBox I would like to set active after any view is loaded or created of an MDI architecture.

    Any Suggestions,
    Shawn
    [email protected]


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured