ccombobox
"jan702189" <[email protected]>
| Newsgroups | gmane.comp.windows.wtl |
|---|---|
| Message-ID | <[email protected]> |
The problem I'm having with the following code is that I can't enter any text into the edit control. CComboView.Create(...) is called from my app.
WNDPROC lpfnEditWndProc; // original wndproc for the combo box
// Prototypes
LRESULT CALLBACK SubClassProc( HWND, UINT, WPARAM, LPARAM );
template< class T, class TBase = CWindow, class TWinTraits = CControlWinTraits >
class ATL_NO_VTABLE CComboImpl :
public CWindowImpl< T, TBase, TWinTraits >
{
public:
CComboBox ctl;
BEGIN_MSG_MAP(CComboView)
MESSAGE_HANDLER(WM_CREATE, OnCreate)
END_MSG_MAP()
LRESULT OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL&
/*bHandled*/)
{
//ModifyStyle(WS_CLIPCHILDREN, SS_NOTIFY);
RECT rfc;
rfc.bottom=200;
rfc.left=rfc.top=0;
rfc.right=800;
ctl.Create(m_hWnd, rfc, NULL, WS_CHILD | WS_VISIBLE|CBS_DROPDOWN);
lpfnEditWndProc = (WNDPROC) ::SetWindowLong(hEdit,
GWL_WNDPROC, (DWORD) SubClassProc);
return 0;
}
};
class CComboView : public CComboImpl<CComboView>
{
public:
//DECLARE_WND_SUPERCLASS(NULL, CComboBox::GetWndClassName())
//DECLARE_WND_CLASS(NULL)
BEGIN_MSG_MAP(CComboView)
CHAIN_MSG_MAP(CComboImpl<CComboView>);
END_MSG_MAP()
};
LRESULT CALLBACK SubClassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg)
{
case WM_CHAR:
//{
switch (wParam)
{
case VK_RETURN:
/*TODO: work out what to do with combobox text*/
return 0;
}
//}
}
// Call the original window procedure for default processing.
return CallWindowProc(lpfnEditWndProc, hwnd,
msg, wParam, lParam);
}
------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/wtl/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/wtl/join
(Yahoo! ID required)
<*> To change settings via email:
[email protected]
[email protected]
<*> To unsubscribe from this group, send an email to:
[email protected]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/