How to Change the Text in the Tabs of a CPropertySheetLast reviewed: October 10, 1997Article ID: Q141487 |
4.00
WINDOWS NT
kbprg kbhowto kbcode
The information in this article applies to:
SUMMARYThe text that appears in the tabs of a CPropertySheet are usually taken from the caption of each CPropertyPage in the dialog template resource. There are some other methods that can be used to select the caption for each page.
MORE INFORMATION
Three Methods You Can Use to Select the Caption for Each Page
Sample Code
/* Compile options needed: Default */ // CMySheet is derived from CPropertySheet. // CPage1 is derived from CPropertyPage. // METHOD ONE ====================================================== // passing the string ID to the constructor. ClassWizard does not // generate a constructor that takes the caption ID as a parameter, // so it may be necessary to modify the CPage1's constructorclass CPage1 : public CPropertyPage { // ...public: CPage1(UINT nIDCaption = 0); // ...}; CPage1::CPage1(UINT nIDCaption) : CPropertyPage(CMyPage::IDD, nIDCaption) { //{{AFX_DATA_INIT(CMyPage) // NOTE: the ClassWizard will add member initialization here //}}AFX_DATA_INIT}
// Use the class's constructor to pass the string IDCMyView::ShowPropertySheet () { m_pSheet = new CMySheet ("Sheet Title"); ASSERT (m_pSheet); m_pPage1 = new CPage1(IDS_MYCAPTION); // id of string resource ASSERT (m_pPage1); m_pSheet->DoModal ();}
// METHOD TWO ====================================================== // this shows how to change the title of a CPropertyPage before the // call to DoModal()CMyView::ShowPropertySheet () { m_pSheet = new CMySheet ("Sheet Title"); ASSERT (m_pSheet); m_pPage1 = new CPage1; ASSERT (m_pPage1); m_pPage1->m_psp.dwFlags |= PSP_USETITLE; m_pPage1->m_psp.pszTitle = _T("My Caption"); m_pSheet->DoModal ();}
// METHOD THREE ====================================================== // This function allows you to pass the index number of a // CPropertyPage and a string to set the title to.BOOL CMySheet::SetPageTitle (int nPage, LPTSTR pszText) { CTabCtrl* pTab = GetTabControl(); ASSERT (pTab); TC_ITEM ti; ti.mask = TCIF_TEXT; ti.pszText = pszText; VERIFY (pTab->SetItem (nPage, &ti)); return TRUE;}
|
Additional reference words: kbinf 4.00
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |