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. HOWTO : Get a CPropertySheet pointer from a CPropertyPage !?!?!?!

HOWTO : Get a CPropertySheet pointer from a CPropertyPage !?!?!?!

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
5 Posts 4 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.
  • L Offline
    L Offline
    Luc Bergeron
    wrote on last edited by
    #1

    Hello to all fellow programmers :) Like the title says... What's the best method to get a CPropertySheet pointer from within a CPropertyPage ? Thanx in advance for any help and have a nice day !

    P M S L 4 Replies Last reply
    0
    • L Luc Bergeron

      Hello to all fellow programmers :) Like the title says... What's the best method to get a CPropertySheet pointer from within a CPropertyPage ? Thanx in advance for any help and have a nice day !

      P Offline
      P Offline
      Paolo Messina
      wrote on last edited by
      #2

      I guess you may use a simple GetParent(), because the pages are children of the property sheet and not of the tab control. The best way to know is trying :) Cheers, Paolo.

      1 Reply Last reply
      0
      • L Luc Bergeron

        Hello to all fellow programmers :) Like the title says... What's the best method to get a CPropertySheet pointer from within a CPropertyPage ? Thanx in advance for any help and have a nice day !

        M Offline
        M Offline
        Mike Dunn
        wrote on last edited by
        #3

        Paolo is right, but you'll need to cast the return from GetParent() to a CPropertySheet*. So you'd do this in your CPropertyPage-derived class: CPropertySheet* pSheet = (CPropertySheet*) GetParent(); If you need to access memebers of your CPropertySheet-derived class, just replace CPropertySheet in the code above with the name of your derived class.

        1 Reply Last reply
        0
        • L Luc Bergeron

          Hello to all fellow programmers :) Like the title says... What's the best method to get a CPropertySheet pointer from within a CPropertyPage ? Thanx in advance for any help and have a nice day !

          S Offline
          S Offline
          Steve Driessens
          wrote on last edited by
          #4

          G'day Luc, Something that I do quite frequently when dealing with property sheets is to create a base class for the property pages - say CBasePropertyPage - and add member functions to access the parent property sheet. I.e CMyPropertySheet* CBasePropertyPage::GetPropSheet() { return (CMyPropertySheet*)GetParent(); } I also add member functions to access data that is stored or managed by the property sheet. I.e. CMyDataClass* CBasePropertyPage::GetDataPtr() { return GetPropSheet()->m_pDataPtr; } I then derive my property pages from this class. This gives *all* of the property pages easy access to the parent property sheet and any data that it maintains. Hope this helps. Steve

          1 Reply Last reply
          0
          • L Luc Bergeron

            Hello to all fellow programmers :) Like the title says... What's the best method to get a CPropertySheet pointer from within a CPropertyPage ? Thanx in advance for any help and have a nice day !

            L Offline
            L Offline
            Luc Bergeron
            wrote on last edited by
            #5

            Good :) Thanx for everyone who gave me an answer :) It's fun to have such a good support from anyone in the world :) Have a nice day !

            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