Change Name of Property Page in Property Sheet?

Posted on 2001-07-11
Last Modified: 2013-11-20
I have a Property Sheet that contains a Property Page.
I want to override the name of the Page in the Sheet.
Currently it grabs the default name from the dialog resource.
I tried a SetWindowText() call in my OnInitDialog of
the Page, but this does not work.
However, the same code does work if the Page is a
dialog by itself (ie: not in a Sheet).

Does anybody know how to do this?

Question by:bwilhelm
LVL 15

Expert Comment

ID: 6274778
You can try the PSM_GETTABCONTROL message to get the tab control handle, then TCM_SETITEM to set the item text.

Author Comment

ID: 6274993
Thanks for the tip.
I tried it and it works great as long as I call it from within the Sheet's OnInitDialog().
However, I need a way to do this from the Page class,
since our Sheet class is generic and is designed to hold different
arrangements of pages.

Likewise I was not able to this at a higher level, where the Sheet
is created and pages are added to it.  This is because the TabControl
is not a valid window handle until DoModal() is called, and by then it's
too late to change the string.

Do you have any other suggestions?

Expert Comment

ID: 6275460
// this example to set caption for tab #1 in property sheet
#define TAB_INDEX 1

void CFindSheet::SetTabCaption()
 CTabCtrl* pTab = GetTabControl();
 TC_ITEM ti;
 char szText[100];
 ti.mask = TCIF_TEXT;
 ti.pszText = szText;
 ti.cchTextMax = 100;
 VERIFY(pTab->GetItem(TAB_INDEX, &ti));

 strcpy(szText, "Your tab caption");
 VERIFY(pTab->SetItem(TAB_INDEX, &ti));

then call SetTabCaption on CFindSheet::OnInitDialog()
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

LVL 49

Expert Comment

ID: 6324158
hi bwilhelm,
Are you still following this question?  Are you interested in another approach?

-- Dan

Author Comment

ID: 6324761
I worked around this problem by making a non-generic sheet
and implementing the TCM_SETITEM calls.

However, I am still interested in any alternate solutions that
do not involve changing the sheet.
LVL 49

Accepted Solution

DanRollins earned 200 total points
ID: 6325074
I use code like:
  m_cMyPg.m_psp.pszTitle= "&New Title";
  m_cMyPg.m_psp.dwFlags |= PSP_USETITLE;

before I call cSheet.DoModal();

>>However, I need a way to do this from the Page class,
>>since our Sheet class is generic and is designed to hold
>>different arrangements of pages.

You could do it in the CPropertyPage-derived class's ctor or whereever else you instantiate the object.  It won't work after the sheet has been created.

-- Dan

Author Comment

ID: 6326997
Exactly what I was looking for.  Thanks!

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
bobThere java chalenge 45 92
Doc'in system (example?) BA 7 105
mapBully challenge 6 127
Thin secure Windows 10 5 93
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

806 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