bwilhelm
asked on
Change Name of Property Page in Property Sheet?
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
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
You can try the PSM_GETTABCONTROL message to get the tab control handle, then TCM_SETITEM to set the item text.
ASKER
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?
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?
// 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_I NDEX, &ti));
strcpy(szText, "Your tab caption");
VERIFY(pTab->SetItem(TAB_I NDEX, &ti));
}
then call SetTabCaption on CFindSheet::OnInitDialog()
#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_I
strcpy(szText, "Your tab caption");
VERIFY(pTab->SetItem(TAB_I
}
then call SetTabCaption on CFindSheet::OnInitDialog()
hi bwilhelm,
Are you still following this question? Are you interested in another approach?
-- Dan
Are you still following this question? Are you interested in another approach?
-- Dan
ASKER
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.
and implementing the TCM_SETITEM calls.
However, I am still interested in any alternate solutions that
do not involve changing the sheet.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Exactly what I was looking for. Thanks!