Hi,
Since Windows CE/Mobile does support any type of owner-drawn list
boxes (used in combo boxes), I am trying to develop a replacement. The
replacement is a custom CWnd-derived class called MFC32CQBComboEx (to
take advantage of custom draw in CListCtrl).
In MFC32CQBComboEx OnCreate() (WM_CREATE) I spawn child windows: an
edit control, a button, and a list control:
...
DWORD dwFlags = WS_EX_TOOLWINDOW;
#ifndef UNDER_CE
dwFlags = dwFlags | WS_EX_LEFT | WS_EX_LTRREADING;
#endif // UNDER_CE
...
VERIFY(m_pWndSubListCtrl->CreateEx(dwFlags, WC_LISTVIEW, _T(""),
WS_POPUP | WS_BORDER, 0, 0, 0, 0, GetParent()->GetSafeHwnd(), (HMENU)
0));
...
where pWndSubListCtrl a pointer to an instance of:
class CQBComboDropList : public CListCtrl
{
}
The CListCtrl is created with CreateEx() and WS_POPUP, since if the
combo drop-down is created as a regular WS_CHILD and it overlaps an
edit control, there are problems with mouse pointer/flashing/focus.
All of the code seems to work perfectly on the desktop side, but
Windows CE/Mobile is giving me the following weird behavior:
1. CListCtrl ::SetColumn() bombs out with stack overflow errors. It
works on desktop. Moving the SetColumn() to, say, WM_ACTIVATE causes
the same overflow under Windows CE/Mobile.
void CQBComboDropList::OnSize(UINT nType, int cx, int cy)
{
CListCtrl::OnSize(nType, cx, cy);
if (m_bCreateOk)
{
// account for the fact that we might have
// a vertical scrollbar and adjust first column
// to give "list-box" type of feel
LVCOLUMN col;
col.mask = LVCF_WIDTH;
col.cx = cx;
SetColumn(0, &col);
}
}
2. ON_NOTIFY_REFLECT(LVN_ITEMCHANGED, OnItemChanged) never fires under
Windows CE/Mobile. Works fine on desktop. void
CQBComboDropList::OnItemChanged(NMHDR* pNMHDR, LRESULT* pResult) never
gets called.
Both of those "weird" cases lead me to believe that there is something
I am missing here in the "wide" picture. Any suggestions?
Thanks,
Gary