-
April 7th, 2004, 12:57 PM
#1
Change dialog caption
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()?
-
April 7th, 2004, 01:03 PM
#2
yeah. SetWindowText in OnInitDialog should work.
-
April 7th, 2004, 01:10 PM
#3
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.
-
April 7th, 2004, 01:15 PM
#4
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 |
|-------------|--------------|
-
April 7th, 2004, 01:21 PM
#5
I would like the change the name of the tab... but the tab name will not be derminted until runtime.
-
April 7th, 2004, 01:38 PM
#6
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);
-
April 7th, 2004, 01:59 PM
#7
I changed int nPageIndex = GetPageIndex(this); to int nPageIndex = pSheet->GetPageIndex(this); and it worked beautifully. Thanks a lot.
-
April 7th, 2004, 02:00 PM
#8
Originally posted by mjm461
I changed int nPageIndex = GetPageIndex(this); to int nPageIndex = pSheet->GetPageIndex(this);
Yeah. My bad
-
April 8th, 2004, 07:47 AM
#9
Originally posted by mjm461
I would like the change the name of the tab... but the tab name will not be derminted until runtime.
Why didn't you ask this in the first place?
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
|