|
-
September 15th, 1999, 06:03 AM
#1
Changing Title of propertypage
Changing the title of a propertypage!
How can I change the title of a propertypage during runtime after I've added it already to the propertysheet? Because SetWindowText() doesn't work in my application!
I use VC 5.0!
Thanks a lot for your reply!
Ralph
-
September 15th, 1999, 06:08 AM
#2
Re: Changing Title of propertypage
Hi,
try this:
CMyPropSheet::SetPageTitle (int nPage, LPTSTR pszText)
{
CTabCtrl* pTab = GetTabControl();
TC_ITEM ti;
ti.mask = TCIF_TEXT;
ti.pszText = pszText;
pTab->SetItem (nPage, &ti);
}
Hope this helps,
Oleg.
-
September 15th, 1999, 06:37 AM
#3
Re: Changing Title of propertypage
You create your CPropertyPage objects ( m_dlgPage1) and CPropertySheet object ( m_dlgPropSheet)
1- Add your page:
/* --- Add the pages --- */
m_dlgPropSheet->AddPage(m_dlgPage1);
2- Change its title
/* --- Add the title --- */
m_dlgPage1->m_psp.pszTitle = _T("My title");
m_dlgPage1->m_psp.dwFlags |= PSP_USETITLE;
Bye
Sandrine
-
September 15th, 1999, 08:45 AM
#4
Re: Changing Title of propertypage
Thanks a lot for your reply!
It works!
have a nice day !
Ralph
-
September 15th, 1999, 08:47 AM
#5
Re: Changing Title of propertypage
Thanks a lot for your reply!
But this suggestion will only work BEFORE you call the AddPage() methode!
have a nice day !
Ralph
-
September 15th, 1999, 09:12 AM
#6
Re: Changing Title of propertypage
?????
This is my code ( A part of the OnInitDialogDialog function of the dialog box which contains the property sheet). And It works...
// Property Sheet
/* --- Create the property sheet object --- */
m_dlgPropSheet = new CPropertySheet;
/* --- Create Property Page Object --- */
m_dlgPage1 = new CConvSimulPage;
m_dlgPage2 = new CConvSimulPagebis;
/* --- Add the pages --- */
m_dlgPropSheet->AddPage(m_dlgPage1);
m_dlgPropSheet->AddPage(m_dlgPage2);
/* --- Add the title --- */
m_dlgPage1->m_psp.pszTitle = _T("Solar Array");
m_dlgPage1->m_psp.dwFlags |= PSP_USETITLE;
m_dlgPage2->m_psp.pszTitle = _T("Battery");
m_dlgPage2->m_psp.dwFlags |= PSP_USETITLE;
/* --- Initialization and display the property sheet --- */
m_dlgPropSheet->Create(this, WS_CHILD | WS_VISIBLE, 0 );
m_dlgPropSheet->ModifyStyleEx(0, WS_EX_CONTROLPARENT);
m_dlgPropSheet->ModifyStyle(0,WS_TABSTOP);
CRect rcSheet;
GetDlgItem(IDC_PROPSHEET)->GetWindowRect(&rcSheet);
ScreenToClient(&rcSheet);
.....
Something wrong??
Bye
Sandrine
-
September 15th, 1999, 11:49 AM
#7
Re: Changing Title of propertypage
Thanks for the complete code, but I'm not sure whether the changing of the title will work after the "m_dlgPropSheet->Create()". With other words:
after OnInitDialog() and when your dialog appears
you should be able to change the title by pressing a certain button (for example) in your dialogbox.
I tested the other suggestion and it works in this
way.
Thanks a lot again!
bye
Ralph
-
January 3rd, 2000, 11:59 AM
#8
Re: Changing Title of propertypage
I tried Sandrine's method because it looked _much_ simpler. It works fine after the OnCreate of the PropertySheet (though I do use it before the DoModal, that shows the property sheet). The only caveat is that Sandrine's code declares a PropertyPage, but references it as a *pointer* to a PropertyPage. The '->' should be a '.' (period).
-
June 7th, 2000, 12:47 PM
#9
Re: Changing Title of propertypage
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|