Solved

Set title text of CPropertyPage in wizard at runtime

Posted on 2006-11-29
9
1,635 Views
Last Modified: 2013-11-20
Ah hello.

I have a wizard based on CPropertyPage.  The pages of my app look very similar to that shown at

http://www.codeproject.com/property/Conquering_Wizard97/Fig-5b.jpg

Now, if you look at this image, you will see it has the text "Title" and "Sub Title".  This has been set up in the constructor like so

CSecondPage::CSecondPage()
    : CPropertyPage(CSecondPage::IDD)
{
    m_psp.dwFlags |= PSP_DEFAULT|PSP_USEHEADERTITLE|PSP_USEHEADERSUBTITLE;
    m_psp.pszHeaderTitle = _T("Title");
    m_psp.pszHeaderSubTitle = _T("And subtitle");
}

Now, the simple question: I need to be able to change this text at runtime, but cannot see at all a method of allowing me to do so.

Does anyone know how ?

TIA
0
Comment
Question by:mrwad99
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 44

Accepted Solution

by:
AndyAinscow earned 125 total points
ID: 18036883
The only way I can think of would be to iterate through the child controls of the sheet, find the one with the text you want to replace and then replace that window text with the new text.

(Not tried it so it may not function correctly)
0
 
LVL 1

Expert Comment

by:ITSpgrmr
ID: 18037508
I would do something like adding a function to CSecondPage to set the Header.  Like this(the same for pszHeaderSubTitle) :
void CSecondPage::ChangeHeader(LPSTR pNewHeader)
{
      m_psp.pszHeaderTitle = _T(pNewHeader);
}
 Then you can change the variable like this:
m_pgSecond.ChangeHeader("NewHeader");
0
 
LVL 19

Author Comment

by:mrwad99
ID: 18044255
ITSpgrmr

Thanks for posting.  However, if it was that easy, I would not need to post.  It appears that the m_psp structure is used somehow that I cannot find by tracing stepping into and out of my code.  Once it is set up in the constructor, whatever is reading the values from it is not being called to read them again.  This is why your suggestion does not work.

Andy

That is possible, but an outrageous hack ( ;0) ) that I would like to avoid if at all possible.

Does anyone know where the m_psp variable is read and used ?

Thanks.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 44

Expert Comment

by:AndyAinscow
ID: 18044283
I agree - hack (but if it works only a few lines of simple code).  Why the MFC doesn't seem to support it I can't quite understand.

m_psp usage - I think it is *only* used when the page is created.
0
 
LVL 19

Author Comment

by:mrwad99
ID: 18121912
Not what I was hoping for, but it will do.

Thanks Andy.
0
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 18121965
Sometimes we have to be satisfied with what works ;-)
0
 
LVL 11

Expert Comment

by:alexcohn
ID: 20933168
I am sorry to disappoint, but unfortunately the wizard page does not contain a child for the header and subheader. It's not a coincidence that these features depend on IE version installed: they are rendered via IE mechanisms, bypassing child windows.
0
 
LVL 19

Author Comment

by:mrwad99
ID: 20936277
Heh, quite an old question this one... thanks for the follow up though alexcohn!
0
 
LVL 11

Expert Comment

by:alexcohn
ID: 20936763
I was looking for the solution, found this thread and saw that Andy suggested some way that I already had rejected. I have settled for brute-force approach: I create two STATIC controls on the PropertySheet surface, set the fonts and positions exactly as the Wizard does for header and subheader, and make sure they are drawn with transparent background.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Show shut-down message as Windows 8 shuts down. 9 109
Unix / Linux grid computing 5 171
Named range not carried over 10 70
Capture logon name 13 116
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question