Solved

Changing captions on the CPropertyPage tab...

Posted on 1997-09-17
1
633 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 50 total points
Comment Utility
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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

772 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now