Creating a simple Custom Control
Posted on 2004-09-08
Hello, once again I wasted a lot of time today trying to get something supposedly trivial done that was actually supposed to save me some time.
- Put some controls (a textfield, 2 buttons and maybe a static label or picture control) into a small property sheet and layout them within the resource editor.
- Create a subclass of CDialog with variables for these controls and initialize them with the mentioned property sheet.
- Put a dozen of these subclass instances into another dialog and layout them as Custom Controls.
It worked more or less well except the "... and initialize them with the mentioned property sheet" part.
I'm pretty new to MFC and Win32 and assumed that all I need to do is to get the DoDataExchange method invoked from somewhere and this would create and initialize the subcontrols. But I keep getting Assertion failed and various errors when I try to do this in a similar way as seems to be done by the CTabCtrl. The class itself (without it's contents) run's well and instances of it can be placed in a dialog.
I'm sure someone of you can help me to get this done.