MFC MDI Problem with SetLook even with header file in place

91 views Asked by At

I've implemented a Property Sheet and several Property Pages that are called from the Main Menu from the MainFrame.cpp spawned from my issue here:

MFC MDI Designing user preferences dialog GUI layout functionality

The code I landed on was:

BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWndEx)
    Other messages...  
    ON_COMMAND(ID_SETTINGS_DIALOG, OnSettingsTools)
    Other messages... 
END_MESSAGE_MAP()

void CMainFrame::OnSettingsTools()
{

    SettingsSheet SettingsSheet(L"Application Settings");

    CSettingsPowerUser      m_PowerUser;
    CSettingsReset          m_Reset;
    CSettingsToolbars       m_Toolbars;
    CSettingsUserWarnings   m_UserWarnings;

    SettingsSheet.AddPage(&m_PowerUser);
    SettingsSheet.AddPage(&m_Reset);
    SettingsSheet.AddPage(&m_Toolbars);
    SettingsSheet.AddPage(&m_UserWarnings);

    //SetLook(CMFCPropertySheet::PropSheetLook_OneNoteTabs);

    SettingsSheet.DoModal();
}

Yielding:

Settings Sheet/Pages Working

I have included in MainFrame.h

#include <afxpropertysheet.h>

The property sheet is using CMFCPropertySheet in both the .cpp & .h as shown here in its .h file:

class SettingsSheet : public CMFCPropertySheet
{
    DECLARE_DYNAMIC(SettingsSheet)

public:
    SettingsSheet(UINT nIDCaption, CWnd* pParentWnd = nullptr, UINT iSelectPage = 0);
    SettingsSheet(LPCTSTR pszCaption, CWnd* pParentWnd = nullptr, UINT iSelectPage = 0);
    virtual ~SettingsSheet();

protected:
    DECLARE_MESSAGE_MAP()
};

So what the issue here is, you can see that I had to comment out the SetLook(CMFCPropertySheet::PropSheetLook_OneNoteTabs); because I get an error that says SetLook identifier not found C3861.

If I hover inside the MainForm.h and right click the #include <afxpropertysheet.h> the file opens right up in the IDE and if I search for SetLook it most certainly can find it in the public section of the function.

So I've seen multiple code examples that use that SetLook and one of the tutorials I looked at used it and it works fine as I'm using VS2017.

I realize what a "not found is", but I'm at a loss as to why it's a problem here. It is the only error I am having now and I would like to use that functionality.

Thoughts on what may be going on here?

Update:

Following Dxiv's advice I changed the code to:

SettingsSheet.SetLook(CMFCPropertySheet::PropSheetLook_OneNoteTabs);

It now compiles and runs, but have some odd results, it only shows one property page, and all the rest are AWOL.

Tabs are missing!

1

There are 1 answers

1
Kittmaster On

I have figured out what the issue was; when I created the dialogs I used the base class of:

CPropertyPage

instead of:

CMFCPropertyPage

I had set the sheet to:

CMFCPropertySheet

and assumed it carried down since it compiled and displayed the tab view correctly, but failed on the other SetLook property options.

Once I adjusted all the dialogs to CMFCPropertyPage, the SetLook started working immediately. So I consider this issue CLOSED.