Go Premium for a chance to win a PS4. Enter to Win


Change Name of Property Page in Property Sheet?

Posted on 2001-07-11
Medium Priority
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()
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

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 800 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
Screencast - Getting to Know the Pipeline

926 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