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