Click to See Complete Forum and Search --> : Setting Focus or Active?


April 19th, 1999, 01:48 PM
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
malicon@frii.com

yash
April 19th, 1999, 02:37 PM
Hi ,
use CWnd::SetFocus .
Good Luck.
Yash.

April 19th, 1999, 02:53 PM
but where? every place I have tried doesn't produce desired result.

Daniel Levine
April 19th, 1999, 02:59 PM
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.

sally
April 19th, 1999, 06:57 PM
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

Sally
April 19th, 1999, 06:57 PM
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

April 19th, 1999, 10:32 PM
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.

April 20th, 1999, 01:16 PM
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
malicon@frii.com