Solved

Change Name of Property Page in Property Sheet?

Posted on 2001-07-11
7
272 Views
Last Modified: 2013-11-20
Hi.
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?

Thanks,
Bruce
0
Comment
Question by:bwilhelm
[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
7 Comments
 
LVL 15

Expert Comment

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

Author Comment

by:bwilhelm
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?
0
 
LVL 2

Expert Comment

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

void CFindSheet::SetTabCaption()
{
 CTabCtrl* pTab = GetTabControl();
 ASSERT(pTab);
 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()
0
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!

 
LVL 49

Expert Comment

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

-- Dan
0
 

Author Comment

by:bwilhelm
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.
0
 
LVL 49

Accepted Solution

by:
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
0
 

Author Comment

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

Featured Post

Industry Leaders: 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

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: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

718 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