Modeless property sheet and OK/Cancel buttons.
-
Hello I'm trying to get the Ok/Cancel buttons to work with a modeless property sheet. I've managed to get all buttons to show by overriding OnInitDialog() (I'm using the CTreePropSheet availible on this site) BOOL CSettingsSheet::OnInitDialog() { m_psh.dwFlags &= ~PSH_HASHELP; m_psh.dwFlags &= ~PSH_NOAPPLYNOW; m_bModeless = FALSE; BOOL bResult = CTreePropSheet::OnInitDialog(); m_bModeless = TRUE; return bResult; } All buttons are shown despite of the dwFlags changes. How can I get rid of the apply/help buttons? Thanks
-
Hello I'm trying to get the Ok/Cancel buttons to work with a modeless property sheet. I've managed to get all buttons to show by overriding OnInitDialog() (I'm using the CTreePropSheet availible on this site) BOOL CSettingsSheet::OnInitDialog() { m_psh.dwFlags &= ~PSH_HASHELP; m_psh.dwFlags &= ~PSH_NOAPPLYNOW; m_bModeless = FALSE; BOOL bResult = CTreePropSheet::OnInitDialog(); m_bModeless = TRUE; return bResult; } All buttons are shown despite of the dwFlags changes. How can I get rid of the apply/help buttons? Thanks
In the Sheets constructor, before any of the pages are constructed, I call this:
//Remove the Apply Button m\_psh.dwFlags |= PSH\_NOAPPLYNOW; //Remove the Help button m\_psh.dwFlags &= ~PSH\_HASHELP;
< edit > And here is what I do in the beginning of OnInitDialog
//see Microsoft Knowledge Base Article - Q146916
m_bModeless=FALSE; //cheat BaseClass into NOT disabling Buttons
m_nFlags |= WF_CONTINUEMODAL;
BOOL bResult = CPropertySheet::OnInitDialog();
m_bModeless= TRUE; //reset to our actual state.
m_nFlags &= ~WF_CONTINUEMODAL;< /edit > Stop asking why - I just copied it from someone, and as it worked I never bothered to think about it again.;)
My opinions may have changed, but not the fact that I am right.