Posted on 2004-09-27
I am creating additional windows in my application where I first create a FrameWnd by calling CreateEx(...) which in turn creates a view by calling CreateView(...) and passes a CRuntimeClass pointer to a CView which in turn creates a CListCtrl who subclasses a CHeaderCtrl. All of these a derived classes. My problem is that OnMeasureItem is never being called for my CListCtrl and I don't know how to get it to be called. I created the method for all of these classes and it was never called for any of them. Furthermore, I created PreTranslateMessage(...) for each of these and looked to see if WM_MEASUREITEM was passed and it never seemed to be. If I try to subclass the list control I get assertions. Without a WM_MEASUREITEM message being called I cannot properly resize the list control when the user changes the font. The funny thing is, I was able to earlier when I simply created a CWnd that created the CListCtrl and subclassed the CHeaderCtrl, but then I couldn't get a dockable toolbar, so I went this more cumbersome route to get the toolbar and suddenly lost the measure item call. In any event, I guess I'm looking for possibly one of two answers.
1. Is there a way I can force MFC to issue the WM_MEASUREITEM message so I can resize my CListCtrl's row heights?
2. Is there a way I can get a dockable toolbar without a whole lot of code for a CWnd not a CFrameWnd.
I prefer the 1st question to be answered but if no one knows I'll take the second.
Thank you for your help,