Ok this is a silly point, but its something that doesn't make sense. Once I hit <enter>, or single click with the mouse while on the "OK" button it calls my OnButtonOk() and initializes some registry code. My question when CDialog::OnOK(); is called(located at the bottom of this code), how does it know that NewProjDialog is active and decides to destroy this window? Because when CDialog::OnOK() is called I'm not passing any window handles to it from CNewProjDialog() to let it know that I'm no longer interested in leaving this dialog open, and I'm now ready to close it up.
// TODO: Add your control notification handler code here
// TODO: Add extra validation here
b.CreateSimKey("HKEY_LOCAL_MACHINE","Software\\Sim\\Sim", "Directory" ,path); // path should stay clean
b.CreateSimKey("HKEY_LOCAL_MACHINE","Software\\Sim\\Sim", "Project", m_projname); // Add as many qualifiers as I want now
MessageBox("No project name selected");
dud.Format("path already exists");
MessageBox("Failed to make new directory");
dud.Format("path=%s Could not chdir path in NewProjDialog::OnOK()",path);
I found your code to be very rewarding. Thanks alot! However, I do have a problem with my code implementing some of your handsomely crafted solutions. The following is my attempt to explain the problem:
I'm getting very close to going back between a combobox control and an button control in a dialog box. The problem arises when I type something into the combobox and select my OnTab function (which I created using your spiffy accelerator idea -Thx). What happens next is I call the on tab and perform the following code which you also provided.
pWndNext->SetFocus(); // <------ Herein lies the prob!
When I set focus after typing the tab the first time it works like a champ. But then my m_add control once it is selected by the <return> key, set focuses back to the m_combobox. Then i type an entry the second, third or infinite time and when I hit tab key what happens is that it executes the above code again in my OnTab function, but the button is not selected, or not selected ***dark***. Its got light a light selection around it instead of a dark selection. How do I get it to be selected, or highlighted dark so that when I hit the enter key it will work a second time to infinity or until I run out of memory which ever comes first.
The reason i want this functionality is because I want to type several things into the combobox hit tab go to my add button hit add, setfocus back to my combobox, type another field, hit tab, and enter my OnAddButton and continue. I don't want to use the mouse b/c it is to cumbersome for large data entry projects. So the main reason is for pure typing frenzied data entrying speed.
In help in this silly problem would be greatly appreciated.
Note: I disabled OnOK() by removing the CDialog::OnOK();, and reinserted this in my added ok button.
Late addition: Ok i just figured out that if I select the dialog preference "Default" that it way stay highlighted black. This does not let the button appear to be selected. It just stays highlighted and when I hit <return> key it doesn't look like it gets pushed down. Maybe all these dialog boxes if selected need to be overridden as far as their on down key and on up key messages are concerned??? Anyone have a solution to this new conundrum? All I have to work with is the member control m_combo.
I am "one of few MFC programmers who prefer using PreTranslateMessage to process keys for a dialog or for controls in a dialog". However, this doesn't work in non-MFC applications. How can I disable Enter and Escape for dialog box without MFC ?
I prefer PreTranslateMessage.
This way seems more confortable (for me) to deal with dialogs/forms. Maybe it's not the best solution.
I've replaced the Enter berhavior: it act as Enter and/or mimics Tab (moves to next control, trap the last enabled control on form); arrows can be used to navigate between controls and/or as selection key in combos/radios. My goal was to make forms behaves "MS-Dos fashion"; no mouse required, but of course not excluded. Seem's silly, but there are still tipyst for whom the mouse is a mennace (in terms of speed). Hope my English... it's readable :))