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. How Can I pass a dynamic message from a parent class to its derived class?

How Can I pass a dynamic message from a parent class to its derived class?

Scheduled Pinned Locked Moved C / C++ / MFC
questionhelp
6 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.
  • M Offline
    M Offline
    mfc_surfer
    wrote on last edited by
    #1

    I have 3 classes that are derived from each other as: class A class B: public Class A class C: public class B I've used a dynamic message in class A which resizes the controls on it. I want to resize the controls on classes B and C as well and I've put BEGIN_DYNAMIC_MAP() ... END_DYNAMIC_MAP() on them but the controls are not resized in classes B and C. Could you help me?

    K 1 Reply Last reply
    0
    • M mfc_surfer

      I have 3 classes that are derived from each other as: class A class B: public Class A class C: public class B I've used a dynamic message in class A which resizes the controls on it. I want to resize the controls on classes B and C as well and I've put BEGIN_DYNAMIC_MAP() ... END_DYNAMIC_MAP() on them but the controls are not resized in classes B and C. Could you help me?

      K Offline
      K Offline
      Kene
      wrote on last edited by
      #2

      I don't know about.. BEGIN_DYNAMIC_MAP() ... END_DYNAMIC_MAP() I think it should be similar to BEGIN/END_MESSAGE_MAP. I'll also assume ur classes (i.e A,B,C) can recieve messages. MFC docs says " if a message can't be matched in a derived class's message map, the framework also searches the message map of its immediate base class". So check to ensure u have something like these... //for class B BEGIN_MESSAGE_MAP(B, A) //.. END_MESSAGE_MAP //for class C BEGIN_MESSAGE_MAP(C, B) //.. END_MESSAGE_MAP search MFC doc for more details goodluck! What would life be without programmers and salesmen?

      M 1 Reply Last reply
      0
      • K Kene

        I don't know about.. BEGIN_DYNAMIC_MAP() ... END_DYNAMIC_MAP() I think it should be similar to BEGIN/END_MESSAGE_MAP. I'll also assume ur classes (i.e A,B,C) can recieve messages. MFC docs says " if a message can't be matched in a derived class's message map, the framework also searches the message map of its immediate base class". So check to ensure u have something like these... //for class B BEGIN_MESSAGE_MAP(B, A) //.. END_MESSAGE_MAP //for class C BEGIN_MESSAGE_MAP(C, B) //.. END_MESSAGE_MAP search MFC doc for more details goodluck! What would life be without programmers and salesmen?

        M Offline
        M Offline
        mfc_surfer
        wrote on last edited by
        #3

        yes BEGIN/END _DYNAMIC_MAP()is something like BEGIN/END_MESSAGE_MAP that has been defined in a class that my A class is derived from that. By the way, I do have //for class B BEGIN_MESSAGE_MAP(B, A) //.. END_MESSAGE_MAP //for class C BEGIN_MESSAGE_MAP(C, B) //.. END_MESSAGE_MAP but nothing happens when resizing the classes B and C, and I couldn't find anything useful in MFC docs except what you have mentioned :(

        K 1 Reply Last reply
        0
        • M mfc_surfer

          yes BEGIN/END _DYNAMIC_MAP()is something like BEGIN/END_MESSAGE_MAP that has been defined in a class that my A class is derived from that. By the way, I do have //for class B BEGIN_MESSAGE_MAP(B, A) //.. END_MESSAGE_MAP //for class C BEGIN_MESSAGE_MAP(C, B) //.. END_MESSAGE_MAP but nothing happens when resizing the classes B and C, and I couldn't find anything useful in MFC docs except what you have mentioned :(

          K Offline
          K Offline
          Kene
          wrote on last edited by
          #4

          You can try calling a virtual mtd (e.g doresize) from ur class A message handler. Remember to implement the mtd in B and C. OR.. If class A is a CWnd kind-of (which I feel it is), then implement the usaul MFC's overidables like 'OnSize' e.t.c. good luck! What would life be without programmers and salesmen?

          M 1 Reply Last reply
          0
          • K Kene

            You can try calling a virtual mtd (e.g doresize) from ur class A message handler. Remember to implement the mtd in B and C. OR.. If class A is a CWnd kind-of (which I feel it is), then implement the usaul MFC's overidables like 'OnSize' e.t.c. good luck! What would life be without programmers and salesmen?

            M Offline
            M Offline
            mfc_surfer
            wrote on last edited by
            #5

            I've implmented OnSize() in child classes and the page itself is resized but the controls are not :confused: I'm using this code to resize the controls and it works in the parent class: BEGIN_DYNAMIC_MAP(CPropPageTabular,CPropPageItemize) DYNAMIC_MAP_ENTRY(IDC_STATIC_REP_OPTIONS, mdResize, mdResize) ... END_DYNAMIC_MAP()

            K 1 Reply Last reply
            0
            • M mfc_surfer

              I've implmented OnSize() in child classes and the page itself is resized but the controls are not :confused: I'm using this code to resize the controls and it works in the parent class: BEGIN_DYNAMIC_MAP(CPropPageTabular,CPropPageItemize) DYNAMIC_MAP_ENTRY(IDC_STATIC_REP_OPTIONS, mdResize, mdResize) ... END_DYNAMIC_MAP()

              K Offline
              K Offline
              Kene
              wrote on last edited by
              #6

              Can I see the details of ur OnSize implementation?:sigh: What would life be without programmers and salesmen?

              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