Click here to Skip to main content
15,909,741 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Shellapi.h in the wrong ver... Pin
Joaquín M López Muñoz17-Jul-02 11:18
Joaquín M López Muñoz17-Jul-02 11:18 
GeneralCan't install Platform SDK Pin
User 665817-Jul-02 10:39
User 665817-Jul-02 10:39 
GeneralRe: Can't install Platform SDK Pin
Rama Krishna Vavilala17-Jul-02 15:15
Rama Krishna Vavilala17-Jul-02 15:15 
QuestionHow to CREATE file with CFile? Pin
Raphael Kindt17-Jul-02 10:31
Raphael Kindt17-Jul-02 10:31 
AnswerRe: How to CREATE file with CFile? Pin
jmkhael17-Jul-02 10:39
jmkhael17-Jul-02 10:39 
AnswerRe: How to CREATE file with CFile? Pin
User 842017-Jul-02 10:38
User 842017-Jul-02 10:38 
GeneralRe: How to CREATE file with CFile? Pin
Raphael Kindt17-Jul-02 10:47
Raphael Kindt17-Jul-02 10:47 
Generalusing inherited MFC dialog classes Pin
moredip17-Jul-02 10:23
moredip17-Jul-02 10:23 
Hi everyone,

I'm hoping someone can shed some light on the use of inheritance with dialog classes. I'm afraid that my situation is a bit tricky to describe. Please bear with me Smile | :)

I've designed a nice dialog (IDD_CEN_SEL). It will always have the same layout of buttons, edit boxes etc, but I want it to react to the user in various different ways. I thought that a good way to do this would be to use C++ inheritance/polymorphism. I created the dialog and the associated C++ class, CCenSelBase. I mplementd all of the constant functionality in the base class. I then created an inherited class CCenSelMapping : public CCenSelBase. This reacted to the user interface in certain specific ways. I also created a class CCenSelPlane : public CCenSelBase with slightly different functionality. This all worked nicely, and I was happy. Can you feel a 'But' coming...

But, I then created a new class CCenSelOffset : public CCenSelMapping. So I have a class inheriting from a class that inherits from the base class. Here's were it all gets very confusing.

here's some snippets of code:
BOOL DCenSelBase::OnInitDialog() 
{
	CDialog::OnInitDialog();
...
...
BOOL DCenSelMapper::OnInitDialog() 
{
	DCenSelBase::OnInitDialog();
	//init the TabView
	InitTabs(m_tab);
...
...
BOOL DCenSelOffset::OnInitDialog() 
{
	DCenSelMapper::OnInitDialog();
...
...

CCenSelMapping uses DataExchange to get a member variable CTabCtrl m_tab, linked to a tab in the dialog. It initialises the tab within InitDialog().

So the tab initialisation code is called in DCenSelMapping::InitDialog(), via a call to DCenSelOffset::InitDialog(). But in DCenSelMapping::InitDialog() m_tab is not intialised (m_tab::m_Hwnd == NULL).
In the debugger, DCenSelOffset::m_tab.m_hWnd is valid, but DCenSelMapping::m_tab.m_hWnd == NULL.

Does this make any sense to anyone? I have a feeling I've described the problem really badly, so if anyone needs more clarification, please ask away.

Any help would be greatly appreciated,

TIA

Pete
GeneralRe: using inherited MFC dialog classes Pin
Joaquín M López Muñoz17-Jul-02 11:11
Joaquín M López Muñoz17-Jul-02 11:11 
GeneralRe: using inherited MFC dialog classes Pin
moredip17-Jul-02 11:39
moredip17-Jul-02 11:39 
GeneralRe: using inherited MFC dialog classes Pin
Joaquín M López Muñoz17-Jul-02 11:44
Joaquín M López Muñoz17-Jul-02 11:44 
GeneralOwnerDraw stuff working differently in Win2K. Pin
Chris Meech17-Jul-02 9:26
Chris Meech17-Jul-02 9:26 
Generalsludgy character array problem Pin
John Aldrich17-Jul-02 8:39
John Aldrich17-Jul-02 8:39 
GeneralRe: sludgy character array problem Pin
Ranjan Banerji17-Jul-02 9:15
Ranjan Banerji17-Jul-02 9:15 
GeneralRe: sludgy character array problem Pin
jmkhael17-Jul-02 10:14
jmkhael17-Jul-02 10:14 
GeneralUnicode + console app + cout Pin
Chris Losinger17-Jul-02 8:25
professionalChris Losinger17-Jul-02 8:25 
GeneralRe: Unicode + console app + cout Pin
Navin17-Jul-02 10:33
Navin17-Jul-02 10:33 
GeneralRe: Unicode + console app + cout Pin
Chris Losinger17-Jul-02 10:49
professionalChris Losinger17-Jul-02 10:49 
GeneralRe: Unicode + console app + cout Pin
Daniel Lohmann17-Jul-02 13:58
Daniel Lohmann17-Jul-02 13:58 
QuestionTitle Bar Font? Pin
Dave_17-Jul-02 8:14
Dave_17-Jul-02 8:14 
AnswerRe: Title Bar Font? Pin
Anonymous17-Jul-02 8:27
Anonymous17-Jul-02 8:27 
GeneralRe: Title Bar Font? Pin
Dave_17-Jul-02 8:28
Dave_17-Jul-02 8:28 
AnswerRe: Title Bar Font? Pin
Jeremy Falcon17-Jul-02 11:29
professionalJeremy Falcon17-Jul-02 11:29 
QuestionTrayClock??? Pin
kekeguo17-Jul-02 8:12
kekeguo17-Jul-02 8:12 
GeneralQuestion about sequence of events Pin
ns17-Jul-02 8:12
ns17-Jul-02 8:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.