I want to change the dialog text while as the new dialog is being created. I tried SetWindowText("yada"). Doesnt seem to work. How can I do this? And do I do it somwhere like OnInitDialog()?
Printable View
I want to change the dialog text while as the new dialog is being created. I tried SetWindowText("yada"). Doesnt seem to work. How can I do this? And do I do it somwhere like OnInitDialog()?
yeah. SetWindowText in OnInitDialog should work.
Do I need to call something to refresh the window then? Nothing happens. Also... I actually inherit from CPropertyPage and not CDialog, Because I am using it as a tab.
Ok. Let me get this right ?
You are using a PropertyPage within a property sheet.
Do you want to change the text of the Sheet or do you want to to change the text of the tab ?
For e.g.
------------------------------------------------
Property Sheet title
------------------------------------------------
|-------------|--------------|
|Pagetitle1| Pagetitle2 |
|-------------|--------------|
I would like the change the name of the tab... but the tab name will not be derminted until runtime.
Note that in a propertysheet, he tabs shown for each page is a tab control window. So you would have to manipulate the tab control's items. That is the reason why , even if SetWindowText won't fail, it has no effect on the appearance on the tabs.
What you need to do is something like this. From MSDN sample:
When you want to change the text, say in OnInitDialog()...( you could do it any time after the property page is created )
TCITEM tcItem;
CString pszString = "Test page title";
CPropertySheet* pSheet = (CPropertySheet*)GetParent();
ASSERT_VALID(pSheet);
int nPageIndex = GetPageIndex(this);
// Get the page text.
tcItem.mask = TCIF_TEXT;
pSheet->GetTabControl()->GetItem(nPageIndex, &tcItem);
// Set the new text for the item.
tcItem.pszText = pszString.GetBuffer(256);
// Set the item in the tab control.
pSheet->GetTabControl()->SetItem(nPageIndex, &tcItem);
I changed int nPageIndex = GetPageIndex(this); to int nPageIndex = pSheet->GetPageIndex(this); and it worked beautifully. Thanks a lot.
Yeah. My bad :)Quote:
Originally posted by mjm461
I changed int nPageIndex = GetPageIndex(this); to int nPageIndex = pSheet->GetPageIndex(this);
Why didn't you ask this in the first place?:mad:Quote:
Originally posted by mjm461
I would like the change the name of the tab... but the tab name will not be derminted until runtime.