From: JCO on
okay.. I understand.
Thanks

"Jd" <j.durgaprasad(a)gmail.com> wrote in message
news:52578205-480e-4c08-8460-3ea91c3d10c2(a)v27g2000pro.googlegroups.com...
> On Apr 27, 6:29 am, "JCO" <some...(a)somewhere.com> wrote:
>> Actually nothing I do seems to make a difference. I tried you comments
>> below but I get the same results. I also looked at the link which
>> appears
>> to be the exact code that I have written for each of my three CPage's.
>>
>> Now it bothers me. Its not that I want to get rid of Cancel & Help
>> button,
>> I simply want to understand why my applications shows 4-buttons (most of
>> the
>> time). Page three does hide the Back Button
>>
>> "DanB" <a...(a)some.net> wrote in message
>>
>> news:tpIAn.294642$Dv7.32554(a)newsfe17.iad...
>>
>>
>>
>> > JCO wrote:
>> >> I have a 3-page PropertyPage using CPropertySheet & CPropertyPage (as
>> >> usual).
>> >> My buttons are not what I expected. The code below is what I have on
>> >> page2 (which is derived form CPropertyPage). I have commented out code
>> >> just for referenced.
>>
>> >> This gives me 4-buttons: Back, Next, Cancel, Help. From the code
>> >> below,
>> >> I should only get the Back & Next button.
>>
>> >> BOOL CPage2::OnSetActive()
>> >> {
>> >> CPropertySheet* parent = (CPropertySheet*)GetParent();
>> >> parent->SetWizardButtons(PSWIZB_BACK | PSWIZB_NEXT);
>>
>> > <http://msdn.microsoft.com/en-us/library/ex7e7b4s(VS.80).aspx>
>>
>> > These flags only enable, disable, and change the button text. You would
>> > use the styles to show/hide the other buttons.
>>
>> > m_psh.dwFlags|= PSH_NOAPPLYNOW;
>> > m_psh.dwFlags&= ~PSH_HASHELP;
>>
>> > As far as the cancel button, not sure why you want to hide that. How
>> > would
>> > your client say, 'I don't want to be here' if he/she didn't know about
>> > escape?
>>
>> > Best, Dan.
>
> The buttons you were referring to do not belong to CPropertyPage, but
> to the CPropertySheet.
> That is the reason why you see these buttons even if your pages do not
> have any.
> SetWizardButtons helps you disable/enable these Propertysheet buttons.
> PropertySheet wizard works this way by default.
> Now to change this behavior you need to tweak a little.
> Derive your own PropertySheet class from CPropertySheet, lets call it
> CMyPropSheet.
> Override the OninitDialog.
> BOOL CMyPropSheet::OnInitDialog()
> {
> BOOL bResult = CPropertySheet::OnInitDialog();
>
> CWnd *pButton;
> pButton = GetDlgItem(IDHELP);
> if(pButton)
> pButton->ShowWindow(SW_HIDE);
>
> // Now you can hide any button with the following ids
> //ID_APPLY_NOW Apply
> //ID_WIZBACK Back
> //ID_WIZNEXT Next
> //ID_WIZFINISH Finish
>
> return bResult;
> }