PDA

View Full Version : Initializing focus on edit box C++ HELP!!!!


Melon00
03-03-2006, 08:29 PM
I have an app with a bunch of radio buttons and an edit box. I would like to make one of the radio buttons already selected with the focus set on my edit box when the app opens, i.e. set my defaults upon initializing my app.

I have no problem with setting my default selected radio button. The problem lies within setting the focus to my edit box. I have attempted to put

m_EditBoxVariable.SetFocus();
UpdateData(FALSE);

in several places of my code, such as the OnInitDialog() of the window class and in the member function that gets called when my default radio button gets selected ( OnDefaultRadioSelect() ). The latter works as long as I "click" on my default radio button, but I have to click on it. It doesn't just pop up with the cursor blinking in the edit box. Any thoughts would be greatly appreciated.

Melon00
03-07-2006, 02:57 PM
Still haven't figured this out, any help would be appreciated.

I also attempted to override the CPropertyPage::OnSetActive() function and that still didn't work.

Melon00
03-07-2006, 07:12 PM
Okay so I figured it out. It had to do with setting the tab order to start at the edit box. The tab order started at one of the radio buttons. Another way to do this was to change the return value of my dialog to FALSE. I guess I have to learn to start reading MFC comments. I can't beleive they actually told me something useful!