Re: SubClassing ?
Sticky0002 wrote:
I'm using CListCtrl decleared as
CListCtrl m_cList2Ctrl;
I have a custom class called
CSortListCtrl m_ctrlList;
I need to be able to use "m_cList2Ctrl" to control the control. But i also
need "m_ctrlList" to have control of the same control so it can use it's
custom class (Which is to sort the items in my list control) so when i click
the column it can do everyhting it needs, to make the sorting work.
Did i not explain it well enough or something? Or does everyone not know
anything about subclassing?
Thanks.
You seem to want two member variables that are the same control. That's
not possible, and is not subclassing (in either the C++ or the Windows
meaning of the term). If CSortListCtrl is derived from CListCtrl then
you would use one member variable, like this:
CSortListCtrl m_ctrlList;
This member variable has all the functions of your CSortListCtrl, _and_
all the functions of CListCtrl. No extra calls needed: There is only
one object, and it has only one object name.
Since this seems to be an MFC question, if you have additional questions
about it I suggest you post in the MFC forum, and use the phrase
"deriving from CListCtrl" instead of the term "subclassing."
--
Scott McPhillips [MVP VC++]