15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


Wizard Mode of CPropertySheet

Norman L Covington -- doubleM@cris.com
Saturday, October 12, 1996

Environment: VC++ 4.2/NT 4.0

Dear List Members:

I am creating a derived CPropertySheet that has the SetWizardMode() call
prior to the DoModal(). The pages are dynamically created based on
information collected from the user during the "Steps." Within which message
handler or virtual override to change the Caption to reflect "New Database -
Step X of X" (replacing the X with the "page number")?

I have attempted CPropertySheet::SetTitle() during the
CPropertyPage::OnInitDialog(); I've attempted CWnd::SetWindowText() within
the OnInitDialog; I've tried both methods in the CPropertyPage::OnCreate().
I followed the CPropertySheet::SetTitle() through the MFC code and it either
sets the variables or it sends the message to set the variables/caption.
I've also tried the combinations in CPropertyPage::OnSetActive().

Additionally, after making the calls, I've done both
CPropertyPage::UpdateData(FALSE), CWnd::Invalidate(), but I'm not able to
change the Title/Caption.

Any assistance would be appreciated. Thank you.

Norman




Colin Angus Mackay -- colin.angus.mackay@dial.pipex.com
Sunday, October 13, 1996

When I did this I had the text to appear set up in the resource editor by 
putting the text I wanted as the title of the dialog that was to be that 
particular page.

If this is unsuitable then I would try setting the text for the heading of 
the CPropertyPage rather than the CPropertySheet using SetWindowText();

Colin Mackay.




Norman L Covington -- doubleM@cris.com
Tuesday, October 15, 1996

Colin:

Thank you for your input. I've tried the CMyPropertyPage::SetWindowText()
without the desired behavior. I too have information in the resource file;
however, the desired effect is to change the "Title/Caption" information
dynamically based on the user's response to controls within the page(s) of
the CMyPropertySheet, which is in Wizard Mode.

Norman
doubleM@cris.com

At 10:57 PM 10/13/96 +-100, you wrote:
>When I did this I had the text to appear set up in the resource editor by 
>putting the text I wanted as the title of the dialog that was to be that 
>particular page.
>
>If this is unsuitable then I would try setting the text for the heading of 
>the CPropertyPage rather than the CPropertySheet using SetWindowText();
>
>Colin Mackay.




Shrikanth Swaminathan -- sshri@csi-gmbh.de
Thursday, October 17, 1996

[Mini-digest: 3 responses]

Hello,
I came in a little late on ths thread,
If all u want to do is to change the title of the property page at runtime
something like this works

	CTabCtrl *pTab = pMySheet->GetTabControl();
	TC_ITEM ti;
	ti.mask = TCIF_TEXT;
	ti.pszText = "some new title"
	pTab->SetItem(PageNo, &ti);

Hope that helps
sshri@csi-gmbh.de

----------
> From: Norman 
> To: mfc-l@netcom.com
> Subject: RE: Wizard Mode of CPropertySheet
> Date: Tuesday, October 15, 1996 5:42 PM
> 
> Colin:
> 
> Thank you for your input. I've tried the CMyPropertyPage::SetWindowText()
> without the desired behavior. I too have information in the resource
file;
> however, the desired effect is to change the "Title/Caption" information
> dynamically based on the user's response to controls within the page(s)
of
> the CMyPropertySheet, which is in Wizard Mode.
> 
> Norman
> doubleM@cris.com
> 
> At 10:57 PM 10/13/96 +-100, you wrote:
> >When I did this I had the text to appear set up in the resource editor
by 
> >putting the text I wanted as the title of the dialog that was to be that

> >particular page.
> >
> >If this is unsuitable then I would try setting the text for the heading
of 
> >the CPropertyPage rather than the CPropertySheet using SetWindowText();
> >
> >Colin Mackay.
> 
-----From: WnDBSoft@aol.com

In CPropertyPage, there is a protected CString member called m_strCaption.
 To be able to dynamically set the caption at runtime, here is what to do:

In the page whose caption you want to have the ability to change, for example
CMyPropertyPage, add this function declaration to your *.H file:

// Attributes
public:
          void SetCaption(CString& strCaption) { m_strCaption = strCaption; }

Whenever you want to change the caption, let's say from "Default" to
"Changed", do this to a CMyPropertySheet mySheet object (after the pages are
added):

// If you want to change the caption when the user clicks a particular
button:
// NOTE: Add button-click notification handlers using ClassWizard.

void CMyPropertySheet::OnButtonClicked( )
{
          SetCaption("Changed");
          
          // Any other notification processing
          
          return;
}

void CMyPropertySheet::OnAnyControlNotification( )
{
         SetCaption("Changed");
          
          // Any other notification processing

          return;
}

Good Luck!

Brian
-----From: bliu@campbellsoft.com

     
     At the end of your CMyPropertyPage constructor, add the following two 
     lines.
     
     
     
     
      m_psp.pszTitle = m_strCaption;
      m_psp.dwFlags |= PSP_USETITLE;





| Вернуться в корень Архива |