?
Solved

Changing captions on the CPropertyPage tab...

Posted on 1997-09-17
1
Medium Priority
?
673 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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.
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.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

800 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