Dialog with custom control failed!

Dialog with custom control failed!

Anonymous
Not applicable
499 Views
4 Replies
Message 1 of 5

Dialog with custom control failed!

Anonymous
Not applicable
Yesterday I failed to add a custom control to a new dialog -- it didn't work and didn't even show up. In debug mode,there was no problem with dialog constructor,but pDlg->doModal() was simply skipped and OnInitDialog() was also not called.
Then i had a test on an existing dialog, which had being working with no problem, by simply adding a new custom control into it. The same problem occured again. But if i remove the custom control and rebuild it, the dialog works fine!
Has anyone tried to add a custom control before? This custom control is a MFC based grid control, and i am using VS 2002.
0 Likes
500 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable
Hardly to say anything without piece of code.
If it is resource conflict dig CAcModuleResourceOverride class.
0 Likes
Message 3 of 5

Anonymous
Not applicable
HavalMne:

Actually I just had a test on a sample provided in the SDK -- under directory: samples/editor/mfcsamps/modal. It's just an blank dialog with two buttons: OK and Close. I complied it and it works fine. Then i added a custom control from the Toolbox with no modification of the original codes and recompiled it. And as i expected, it failed without OnInitDialog() being called. I spent some time debugging this but no clues were found.
0 Likes
Message 4 of 5

Anonymous
Not applicable
All my dialogs with usual MFC controls working fine.
You must check your code.
0 Likes
Message 5 of 5

Anonymous
Not applicable
We just ran into this same problem and finally figured out the solution.

When you add the custom control to the resource file, you also have to add a member variable to the dialog class. It is not necessary to link this variable to the control--simply having it in the header file is enough to get the dialog to appear.
0 Likes