From: JCO on 24 Apr 2010 14:20 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); /* A set of flags that customize the function and appearance of the wizard buttons. This parameter can be a combination of the following values: PSWIZB_BACK Back button PSWIZB_NEXT Next button PSWIZB_FINISH Finish button PSWIZB_DISABLEDFINISH Disabled Finish button */ return CPropertyPage::OnSetActive(); } Thanks in advance for your help.
From: DanB on 24 Apr 2010 16:21 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.
From: JCO on 26 Apr 2010 11:15 I understand your point about the "Cancel" button. Yes I should include it. I guess my main point was that I did not understand how the buttons were being created when each dialog has zero buttons. I will study the "Styles.. show/hide" and see what I can do. Thanks "DanB" <abc(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.
From: JCO on 26 Apr 2010 17:29 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" <abc(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.
From: Jd on 27 Apr 2010 01:55
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; } |