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. Access of PropertyPage members

Access of PropertyPage members

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorial
3 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.
  • A Offline
    A Offline
    Arjan Schouten
    wrote on last edited by
    #1

    Hi, I want to access member functions of my derived CPropertyPage Classes from the PropertySheet in a for loop. The problem is that I don't how to get a pointer to the correct PropertyPage Class I can do it like this CParameterList parList; CMainPage* mainPage = GetPage(0); parList = mainPage->GetList(); DoStuff(); CDrivePage* drivePage = GetPage(1); parList = drivePage->GetList(); DoStuff(); and more But it would make more sence if I could do it in a loop for (int i = 0 ; i < GetPageCount(); i++) { CParameterList parList; CPropertyPage* page = GetPage(i); // Now I can only access members of the base class parList = page->GetList(); // So this would not work DoStuff(); } van Padoea

    P 1 Reply Last reply
    0
    • A Arjan Schouten

      Hi, I want to access member functions of my derived CPropertyPage Classes from the PropertySheet in a for loop. The problem is that I don't how to get a pointer to the correct PropertyPage Class I can do it like this CParameterList parList; CMainPage* mainPage = GetPage(0); parList = mainPage->GetList(); DoStuff(); CDrivePage* drivePage = GetPage(1); parList = drivePage->GetList(); DoStuff(); and more But it would make more sence if I could do it in a loop for (int i = 0 ; i < GetPageCount(); i++) { CParameterList parList; CPropertyPage* page = GetPage(i); // Now I can only access members of the base class parList = page->GetList(); // So this would not work DoStuff(); } van Padoea

      P Offline
      P Offline
      Pavel Klocek
      wrote on last edited by
      #2
      1. You can use IsKindOf: CPropertyPage* page = GetPage(i); if(page.IsKindOf(RUNTIME_CLASS(CMainPage))) ((CMainPage*)page)->GetList(); 2) If you have GetList() methods in all your pages, you can derive your pages from a intermediate class which defines the GetList() method as virtual: class CListPage:CPropertyPage { virtual CParameterList GetList()=0; ... } class CMainPage:CListPage { virtual CParameterList GetList(){...} ... } Sonork 100.15206;PavelK
      A 1 Reply Last reply
      0
      • P Pavel Klocek
        1. You can use IsKindOf: CPropertyPage* page = GetPage(i); if(page.IsKindOf(RUNTIME_CLASS(CMainPage))) ((CMainPage*)page)->GetList(); 2) If you have GetList() methods in all your pages, you can derive your pages from a intermediate class which defines the GetList() method as virtual: class CListPage:CPropertyPage { virtual CParameterList GetList()=0; ... } class CMainPage:CListPage { virtual CParameterList GetList(){...} ... } Sonork 100.15206;PavelK
        A Offline
        A Offline
        Arjan Schouten
        wrote on last edited by
        #3

        Thank you, Will try option 2 first. van Padoea. If every fool wore a crown, we would all be king - Lard

        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