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