Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Modeless property sheet and OK/Cancel buttons.

Modeless property sheet and OK/Cancel buttons.

Scheduled Pinned Locked Moved C / C++ / MFC
questionhelp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    justin223
    wrote on last edited by
    #1

    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

    J 1 Reply Last reply
    0
    • J justin223

      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

      J Offline
      J Offline
      jhwurmbach
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups