Link to home
Start Free TrialLog in
Avatar of taeguk
taeguk

asked on

Changing captions on the CPropertyPage tab...

How does one go about setting the tab caption for a derived CPropertyPage that is being used in a CPropertySheet. I know the initial caption can be set in the resource editor when designing the dialog for the property page, but I would like to change the caption dynamically on the fly.

I am assuming to use the CWnd::SetWindowText for the property page, but not sure where to handle this. I have tried setting it in the CPropertySheet OnInitDialog handler, but the property page windows have not yet been created, thus calling the SetWindowText errors with a null window handle.

class CCPage1 : public CPropertyPage
{
...
};

class CCPage2 : public CPropertyPage
{
...
};

class CMyPSheet : public CPropertySheet
{
public:
      // would like create multiple CCpage1 style property pages
    CCPage1 m_page1[2];
    CCPage2 m_page2;

...
};

...

CMyPSheet psheet;

if (psheet.DoModal() == IDOK)
{
   ...
}

...

At some point, I need to set the tab caption for m_page1[0] and m_page1[1].

  i.e.  m_page1[0].SetWindowText("Tab One");
        m_page1[1].SetWindowText("Tab Two");

Thanks for any advice,

Don ...
ASKER CERTIFIED SOLUTION
Avatar of RONSLOW
RONSLOW

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial