There are three steps to making a control in a dialog work with an MFC program. You did two of them and omitting the third will result in the behavior you observed. The third step is to add an edit control to your
IDD_NOTEBOOKS_DIALOG
with the identifier
IDC_EDIT1
in the resource file. This is usually done with the resource editor but it can be done manually if you prefer.
FWIW, I have worked with MFC a long, long time and eventually I got in the habit of never putting dialog class declarations in header files because it is just unnecessary. With the proper interface, nothing else needs to know the details of a dialog's implementation except the dialog itself. The key to this is the interface. A typical interface I would write would like something like this :
bool OpenNotebookDlg( CWnd * pparent, NotebookData & data );
The implementation of that function would be with the dialog's code and would initialize the controls with the data and then, if
OK
is clicked it extracts the data from the dialog and returns true. Usually I would have an
Edit
method in the
NotebookData
class and its implementation would call the function shown. I have found this to be a very clean and easy to use practice. The one caveat to it is the dialog code has to know about the data it is displaying but I consider that to be a fair and appropriate trade-off.