Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 195
  • Last Modified:

How do I change the label/title of a Tab?

I have a CPropertySheet that contains several CPropertyPage instances. The labels of each tab are defined in my resource file. I need to change the label of one of the tabs at runtime. How do I do this?

thanks
Paul
0
PMH4514
Asked:
PMH4514
  • 3
1 Solution
 
waysideCommented:
The constructors for CPropertyPage all take a resource id of a string to use in the tab. You can have your derived class constructors pass that id along to the CProprtyPage constructor. This id can be calculated at runtime.


0
 
AndyAinscowFreelance programmer / ConsultantCommented:
      CString s("Hello world");
      TCITEM tabItem;
      tabItem.mask = TCIF_TEXT;

      tabItem.pszText = s.GetBuffer(0);
      pSheet->GetTabControl()->SetItem(2, &tabItem);  /pSheet is a pointer to your property sheet, this changes the text of the third tab - zero based indexing
0
 
PMH4514Author Commented:
AndyAinscow : would I place that code within my property sheet or within the page whose tab I need to change?
0
 
PMH4514Author Commented:
oh,  nevermind.. I put it in OnInitDialog() of my property sheet, worked perfect. Thanks!
0
 
PMH4514Author Commented:
wayside - I think your solution would work as well, but Andy provided the exact answer to my question. thanks though
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now