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. CPropertySheet Default Button

CPropertySheet Default Button

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
4 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.
  • W Offline
    W Offline
    Wim Jans
    wrote on last edited by
    #1

    Hello, I have a dialog window based on CPropertySheet and I've added 2 CPropertyPages. I have 2 questions: 1) The constructor gives me also an apply button, but I can't find a way to get rid of it. I don't need it. 2) On my CPropertyPages I also have a default button. If I press the dialog closes instead of doing the functionality behind my page default button. I tried to override the OnOk on my Page, this shows my test message, so it is executed, but still the dialog closes. Any ideas how to override the CPropertySheet dialog default button so my CPropertyPage default button is executed, and nothing else? Thanks Wim

    D 1 Reply Last reply
    0
    • W Wim Jans

      Hello, I have a dialog window based on CPropertySheet and I've added 2 CPropertyPages. I have 2 questions: 1) The constructor gives me also an apply button, but I can't find a way to get rid of it. I don't need it. 2) On my CPropertyPages I also have a default button. If I press the dialog closes instead of doing the functionality behind my page default button. I tried to override the OnOk on my Page, this shows my test message, so it is executed, but still the dialog closes. Any ideas how to override the CPropertySheet dialog default button so my CPropertyPage default button is executed, and nothing else? Thanks Wim

      D Offline
      D Offline
      dazinith
      wrote on last edited by
      #2
      1. here is some code that builds a property sheet and gets rid of apply

      // build the property sheet
      CPropertySheet CompSheet("Company Information"); // make new CPropertySheet
      CCompBasic page1(pComp, TRUE); // classes derived from CPropertyPage
      CCompAddr page2(pComp);
      CCompBank page3(pComp);
      CCompDiscountMaint page4(pComp);
      CompSheet.AddPage(&page1); // add the pages to the sheet
      CompSheet.AddPage(&page2);
      CompSheet.AddPage(&page3);
      CompSheet.AddPage(&page4);
      CompSheet.m_psh.dwFlags |= PSH_NOAPPLYNOW; // hide the apply button

      2)in your dialog's onok you are probably still calling onok which is passed to the sheet.. at least thats my initial guess..

      CMyDialog::OnOK()
      {
      AfxMessageBox("woop!");
      // CDialog::OnOK(); <- make sure you arent still calling this
      }

      i may be way off on the 2nd one.. but the 1st will work.. still a newb.. cut me some slack :P -dz

      W 1 Reply Last reply
      0
      • D dazinith
        1. here is some code that builds a property sheet and gets rid of apply

        // build the property sheet
        CPropertySheet CompSheet("Company Information"); // make new CPropertySheet
        CCompBasic page1(pComp, TRUE); // classes derived from CPropertyPage
        CCompAddr page2(pComp);
        CCompBank page3(pComp);
        CCompDiscountMaint page4(pComp);
        CompSheet.AddPage(&page1); // add the pages to the sheet
        CompSheet.AddPage(&page2);
        CompSheet.AddPage(&page3);
        CompSheet.AddPage(&page4);
        CompSheet.m_psh.dwFlags |= PSH_NOAPPLYNOW; // hide the apply button

        2)in your dialog's onok you are probably still calling onok which is passed to the sheet.. at least thats my initial guess..

        CMyDialog::OnOK()
        {
        AfxMessageBox("woop!");
        // CDialog::OnOK(); <- make sure you arent still calling this
        }

        i may be way off on the 2nd one.. but the 1st will work.. still a newb.. cut me some slack :P -dz

        W Offline
        W Offline
        Wim Jans
        wrote on last edited by
        #3

        Hello, Thanks. The first part removed the apply button. The default button behaviour is still there am afraid. I dont't have any default calls in my overrided functions, stil he just act like if the OK button was pressed. I will have to explore the caves of CPropertySheet I suppose.

        W 1 Reply Last reply
        0
        • W Wim Jans

          Hello, Thanks. The first part removed the apply button. The default button behaviour is still there am afraid. I dont't have any default calls in my overrided functions, stil he just act like if the OK button was pressed. I will have to explore the caves of CPropertySheet I suppose.

          W Offline
          W Offline
          Wim Jans
          wrote on last edited by
          #4

          Looks like I first had to dig in the codeproject articles :-O : This[^] article shows in detail how to do it...

          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