How to extend listControl class in C++ and add new functions?
-
19-09-2019 - |
Question
Hi I need to extend the CListControl class in C++/MFC, which will add several new features in the list control, Any one have good sample code ? Or could you please tell me how can i start it ? Thanks in advance!
Or just write the new features and listControl into a ActiveX or COM ?? Which is better ?
Solution
TO add functionality such as you suggest in your comments above I wouldn't even make a derivation of CListCtrl. It would make more sense, IMO, to create a CListCtrlManager class that handles things such as you suggest and then handles populating an associated CListCtrl.
Thing is if you wish to derive from a CListCtrl then it is USUALLY done for handling owner draw. There is very little functionality that REQUIRES a derivation. For example I have a derived list ctrl that provides row colouring based on certain information as well as a checkbox in the list view. To handle that I had to set the owener draw flag and handle list ctrl drawing directly, but you do not need to make a derivation to handle the functionality you desire.