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. Handling the OK button in CPropertySheet

Handling the OK button in CPropertySheet

Scheduled Pinned Locked Moved C / C++ / MFC
hardwarequestion
3 Posts 3 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.
  • M Offline
    M Offline
    magesh
    wrote on last edited by
    #1

    I have a CPropertySheet with three embedded CPropertyPages. In each page when the user handles some controls, their state is saved in the parent CPropertySheet. When the PropertySheet is dismissed by pressing the OK button, the user selection should be saved in a file. But I do not want the caller of the CPropertySheet to do this saving. Rather I want the CPropertySheet to implement this saving. So I did the following. In the CPropertySheet, I manually added a BN_CLICKED message map entry for IDOK (ClassWizard does not do this). This command handler gets called but the OnKillActive() of the currently visible page is not called (which I badly need). Then I used ClassWizard to add the OnOk handler to one of the pages (and removed this from CPropertysheet). Only when this page is active, this OnOk gets called. When some other page is active, the sheet closes automatically. I do not want to override OnOk() for every page that I add to this sheet, yet I still want the CPropertySheet to handle this message. What should I do? Thanks,

    B H 2 Replies Last reply
    0
    • M magesh

      I have a CPropertySheet with three embedded CPropertyPages. In each page when the user handles some controls, their state is saved in the parent CPropertySheet. When the PropertySheet is dismissed by pressing the OK button, the user selection should be saved in a file. But I do not want the caller of the CPropertySheet to do this saving. Rather I want the CPropertySheet to implement this saving. So I did the following. In the CPropertySheet, I manually added a BN_CLICKED message map entry for IDOK (ClassWizard does not do this). This command handler gets called but the OnKillActive() of the currently visible page is not called (which I badly need). Then I used ClassWizard to add the OnOk handler to one of the pages (and removed this from CPropertysheet). Only when this page is active, this OnOk gets called. When some other page is active, the sheet closes automatically. I do not want to override OnOk() for every page that I add to this sheet, yet I still want the CPropertySheet to handle this message. What should I do? Thanks,

      B Offline
      B Offline
      Blake Miller
      wrote on last edited by
      #2

      Why don't you find out what the current page is when your sheet's OK handler is called and then call the active page's OnKillActive() yourself. Then you only have to handle the OK once in the property sheet. You would need to do this anyway if you were overriding something else that closed the sheet, so why not with the OK button handler you overrode in the sheet?

      1 Reply Last reply
      0
      • M magesh

        I have a CPropertySheet with three embedded CPropertyPages. In each page when the user handles some controls, their state is saved in the parent CPropertySheet. When the PropertySheet is dismissed by pressing the OK button, the user selection should be saved in a file. But I do not want the caller of the CPropertySheet to do this saving. Rather I want the CPropertySheet to implement this saving. So I did the following. In the CPropertySheet, I manually added a BN_CLICKED message map entry for IDOK (ClassWizard does not do this). This command handler gets called but the OnKillActive() of the currently visible page is not called (which I badly need). Then I used ClassWizard to add the OnOk handler to one of the pages (and removed this from CPropertysheet). Only when this page is active, this OnOk gets called. When some other page is active, the sheet closes automatically. I do not want to override OnOk() for every page that I add to this sheet, yet I still want the CPropertySheet to handle this message. What should I do? Thanks,

        H Offline
        H Offline
        HP
        wrote on last edited by
        #3

        Hi, if you like i can send you a CPropertySheet derived class that exactly does what you asked for. Best regards Holger

        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