EDN Admin
Well-known member
This may be very basic question, but after doing a lot of search still Im not able to find a complete solution. Im not so good in VC++, so please help.
I basically need to trap WM_KEYDOWN (specifically ENTER button) when focus is in a combox control in a dialog box. Followed the approach specified in subclassing the CComboBox in msdn. CSuperComboBox is derived from CComboBox and OnCtlColor() is done.
I have added messagemap for WM_CHAR and WM_KEYDOWN in the CSuperComboBox.
a. How to attach this user-defined CCombobox to the control present in a CDialog?? I have declared CSuperComboBox m_SuperCombo in the dialog box and tried
m_SuperCombo->Attach() and m_SuperCombo->SubClassDlgItem() both in the OnInitDialog(). After doing this, pressing enter or any char in the combo box in the dialog do not hit the handlers in the CSuperComboBox.
b. When will the HBRUSH CSuperComboBox::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) be called? Till the time dialog came up this method was not hit.
Please focus your answers what else should be done in this appraoch mentioned in the msdn.
View the full article
I basically need to trap WM_KEYDOWN (specifically ENTER button) when focus is in a combox control in a dialog box. Followed the approach specified in subclassing the CComboBox in msdn. CSuperComboBox is derived from CComboBox and OnCtlColor() is done.
I have added messagemap for WM_CHAR and WM_KEYDOWN in the CSuperComboBox.
a. How to attach this user-defined CCombobox to the control present in a CDialog?? I have declared CSuperComboBox m_SuperCombo in the dialog box and tried
m_SuperCombo->Attach() and m_SuperCombo->SubClassDlgItem() both in the OnInitDialog(). After doing this, pressing enter or any char in the combo box in the dialog do not hit the handlers in the CSuperComboBox.
b. When will the HBRUSH CSuperComboBox::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) be called? Till the time dialog came up this method was not hit.
Please focus your answers what else should be done in this appraoch mentioned in the msdn.
View the full article