[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Changing captions on the CPropertyPage tab...

Posted on 1997-09-17
1
Medium Priority
?
692 Views
Last Modified: 2013-11-19
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 ...
0
Comment
Question by:taeguk
1 Comment
 
LVL 10

Accepted Solution

by:
RONSLOW earned 150 total points
ID: 1306481
SetWindowText wil not do it - this is bause there are two things here - the property page is displayed without a caption, so setting window text has no effect.  The tab text is in the tab control (which owns the actual page).  When created, the tab gets its text from the property page windows text, but after that they are not linked.  You have to explicitly tell the tab to change.

This is how to do it,,,

TC_ITEM tcItem;
tcItem.mask = TCIF_TEXT;
tcItem.pszText = "your new caption";
GetTabControl()->SetItem(x, &tcItem );

where x is the tab number.

0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question