Re: ? Extending and (Forcibly?) Overriding a Class
I didn?t override InsertColumn. Instead I made a separate function like you
suggested earlier:
LRESULT CCustList::OnInsertColumn(WPARAM wParam, LPARAM lParam) {
int nCol=(int)wParam;
const LVCOLUMN* pCol=(const LVCOLUMN*)lParam;
CLVCOLUMN Col;
Col.column=*pCol;
Col.iDataType=CLCDATATYPE_UNDEFINED;
Col.iWidthType=CLCWIDTHTYPE_EXACT;
LRESULT lRet=InsertCColumn(nCol, &Col);
return lRet;
}
int CCustList::InsertCColumn(int nCol, const CLVCOLUMN* pColumn) {
//store pColumn->iDataType and pColumn->iWidthType somewhere
int ret =DefWindowProc(LVM_INSERTCOLUMN, (WPARAM)nCol,
(LPARAM)&(pColumn->column));
return ret;
}
This way, I can specifically call InsertCColumn with the new struct that has the
extra info, and any calls to the original handler will use the default settings
for the extra info.
It?s working so far, and the logic seems sound as far as I can tell.
I just need to figure out where to store the extra information (I?m looking for
where the column text, width, etc. are stored; I still believe they are stored
in the header, not the list control):
I?m wondering what CListCtrl::InsertColumn does. I imagine that it is a
wrapper for a message to the CHeaderCtrl right? The list control doesn?t
keep track of the actual columns, the header control does correct? In that
case, things would be easier since I can shift the burden to my custom
header control.
Search the MFC source code to answer those questions.
I already tried that, but there is no information on the relation between a
CListCtrl?s InsertColumn() its CHeaderCtrl. :(
--
Alec S.
news/alec->synetech/cjb/net