Solved

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

Posted on 2004-09-14
5
182 Views
Last Modified: 2013-11-20
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
Comment
Question by:PMH4514
  • 3
5 Comments
 
LVL 14

Expert Comment

by:wayside
ID: 12059144
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
 
LVL 44

Accepted Solution

by:
AndyAinscow earned 50 total points
ID: 12062268
      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
 

Author Comment

by:PMH4514
ID: 12063893
AndyAinscow : would I place that code within my property sheet or within the page whose tab I need to change?
0
 

Author Comment

by:PMH4514
ID: 12063953
oh,  nevermind.. I put it in OnInitDialog() of my property sheet, worked perfect. Thanks!
0
 

Author Comment

by:PMH4514
ID: 12063955
wayside - I think your solution would work as well, but Andy provided the exact answer to my question. thanks though
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

757 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

18 Experts available now in Live!

Get 1:1 Help Now