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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How can I handle the 'Apply' button click individually for each property page ?

How can I handle the 'Apply' button click individually for each property page ?

Scheduled Pinned Locked Moved C / C++ / MFC
question
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.
  • S Offline
    S Offline
    SherTeks
    wrote on last edited by
    #1

    I have two property pages incorporated in a property sheet. Property page 1 has a edit control and property page 2 has a simple push button. I have overridden the OnApply virtual function for both the property pages. When the property sheet is shown, I enable the 'Apply' button by handling EN_cHANGE notification of the edit control for Property page 1. On clicking the 'Apply' button, I show a message defined in overridden OnApply () of Property Page 1 and disable the 'Apply' button by SetModified(FALSE). Then, I go to Property Page 2 tab and click on the button on it to enable the 'Apply' button.Now, I click on the 'Apply' button expecting a message defined in the overridden OnApply() of Property page 2. But, I get the message defined in Property Page 1 first and then get the message in Property page 2. To summarize, On clicking the 'Apply' button while the Property page 2 is active, my control is going into the OnApply() of Property page 1 and then comes into the OnApply() of Property page 2. Why is this happening ? Is this the expected behavior ? Thanks in advance.

    I 1 Reply Last reply
    0
    • S SherTeks

      I have two property pages incorporated in a property sheet. Property page 1 has a edit control and property page 2 has a simple push button. I have overridden the OnApply virtual function for both the property pages. When the property sheet is shown, I enable the 'Apply' button by handling EN_cHANGE notification of the edit control for Property page 1. On clicking the 'Apply' button, I show a message defined in overridden OnApply () of Property Page 1 and disable the 'Apply' button by SetModified(FALSE). Then, I go to Property Page 2 tab and click on the button on it to enable the 'Apply' button.Now, I click on the 'Apply' button expecting a message defined in the overridden OnApply() of Property page 2. But, I get the message defined in Property Page 1 first and then get the message in Property page 2. To summarize, On clicking the 'Apply' button while the Property page 2 is active, my control is going into the OnApply() of Property page 1 and then comes into the OnApply() of Property page 2. Why is this happening ? Is this the expected behavior ? Thanks in advance.

      I Offline
      I Offline
      Iain Clarke Warrior Programmer
      wrote on last edited by
      #2

      SherTeks wrote:

      Why is this happening ? Is this the expected behavior ?

      This is perfectly fine. The Apply button is on the property sheet, not any individual page. To borrow a phrase, "what would happen if it only did Apply to the current page?". It's very easy to imagine how things would break down. If you *really* only wanted it to apply to an individual setting on a page, put a button next to that setting, rather than rely on OnApply. Or you could modify all your OnApply's to check if they're the current page. That's less hard that in sounds - you could have each page inherit from a class inheriting from CPropertyPage called CMyPropertyPageThatBreaksUserExpectations. (OK, my opinion is subtly encoded in the name). I hope this helped, Iain.

      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