Using CContainedWindowT in a base class causes assert in conrete class
-
I have a base template class
template<class T, UINT titleId, int SortIndex, class WindowClass = ATL::CWindowImpl<T>>
class ATL_NO_VTABLE ITabPageImpl : public WindowClass {BEGIN_MSG_MAP_EX(ITabPageImpl)
MSG_WM_CREATE(onCreate)
MSG_WM_DESTROY(onDestroy)REFLECT\_NOTIFICATIONS\_EX()
ALT_MSG_MAP(1)
NOTIFY_CODE_HANDLER_EX(LVN_DELETEITEM, onModifyTable)
END_MSG_MAP()ITabPageImpl() : _table(this, 1) {}
private:
ATL::CContainedWindowTWTL::CListViewCtrl _table;In the onCreate method I subclass a control, if the implementation provides a specific method:
__if_exists(T::getTableControl) {
_table.SubclassWindow(static_cast<T*>(this)->getTableControl());
}However, after subclassing the message loop of T produces an assertion when the subclassed control is supposed to process its first message. The basic Idea is, that I want to put handling of certain messages in the base class and lift the burden on implementation classes. Thanks for any help!
Happy coding, Philipp Kursawe
-
I have a base template class
template<class T, UINT titleId, int SortIndex, class WindowClass = ATL::CWindowImpl<T>>
class ATL_NO_VTABLE ITabPageImpl : public WindowClass {BEGIN_MSG_MAP_EX(ITabPageImpl)
MSG_WM_CREATE(onCreate)
MSG_WM_DESTROY(onDestroy)REFLECT\_NOTIFICATIONS\_EX()
ALT_MSG_MAP(1)
NOTIFY_CODE_HANDLER_EX(LVN_DELETEITEM, onModifyTable)
END_MSG_MAP()ITabPageImpl() : _table(this, 1) {}
private:
ATL::CContainedWindowTWTL::CListViewCtrl _table;In the onCreate method I subclass a control, if the implementation provides a specific method:
__if_exists(T::getTableControl) {
_table.SubclassWindow(static_cast<T*>(this)->getTableControl());
}However, after subclassing the message loop of T produces an assertion when the subclassed control is supposed to process its first message. The basic Idea is, that I want to put handling of certain messages in the base class and lift the burden on implementation classes. Thanks for any help!
Happy coding, Philipp Kursawe
Hi Philipp, You are misunderstanding
ATL::CContainedWindow
operation. Post on the WTL support list[^] for help. cheers, ARWhen the wise (person) points at the moon the fool looks at the finger (Chinese proverb)
-
Hi Philipp, You are misunderstanding
ATL::CContainedWindow
operation. Post on the WTL support list[^] for help. cheers, ARWhen the wise (person) points at the moon the fool looks at the finger (Chinese proverb)
Thanks Alain for your reply! Maybe I should describe what I want to achieve: I want to subclass a child window and pre-handle certain messages in my class before the child window can process them itself. I thought CContainedWindow was the way to go then? In the particular case I want to set the background colour of the window.
Happy coding, Philipp Kursawe