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

x
?
Solved

Change Name of Property Page in Property Sheet?

Posted on 2001-07-11
7
Medium Priority
?
274 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
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
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

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

Author Comment

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

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