wxEND_FLAGS( wxComboBoxStyle )
-IMPLEMENT_DYNAMIC_CLASS_XTI(wxComboBox, wxControl,"wx/combobox.h")
+IMPLEMENT_DYNAMIC_CLASS_XTI(wxComboBox, wxChoice,"wx/combobox.h")
wxBEGIN_PROPERTIES_TABLE(wxComboBox)
wxEVENT_PROPERTY( Select , wxEVT_COMMAND_COMBOBOX_SELECTED , wxCommandEvent )
#else
-IMPLEMENT_DYNAMIC_CLASS(wxComboBox, wxControl)
+IMPLEMENT_DYNAMIC_CLASS(wxComboBox, wxChoice)
#endif
// when Enter is pressed
if ( wParam == VK_RETURN )
{
+ if (SendMessage(GetHwnd(), CB_GETDROPPEDSTATE, 0, 0))
+ return false;
+
wxCommandEvent event(wxEVT_COMMAND_TEXT_ENTER, m_windowId);
const int sel = GetSelection();
// this string is going to become the new combobox value soon but
// we need it to be done right now, otherwise the event handler
// could get a wrong value when it calls our GetValue()
- ::SetWindowText(GetHwnd(), value);
+ ::SetWindowText(GetHwnd(), value.wx_str());
{
wxCommandEvent event(wxEVT_COMMAND_COMBOBOX_SELECTED, GetId());
// skip wxChoice version as it would generate its own events for
// CBN_SELENDOK
- return wxControl::MSWCommand(param, id);
+ return true;
+}
+
+bool wxComboBox::MSWShouldPreProcessMessage(WXMSG *pMsg)
+{
+ // prevent command accelerators from stealing editing
+ // hotkeys when we have the focus
+ if (wxIsCtrlDown())
+ {
+ WPARAM vkey = pMsg->wParam;
+
+ switch (vkey)
+ {
+ case 'C':
+ case 'V':
+ case 'X':
+ case VK_INSERT:
+ case VK_DELETE:
+ case VK_HOME:
+ case VK_END:
+ return false;
+ }
+ }
+
+ return wxChoice::MSWShouldPreProcessMessage(pMsg);
}
WXHWND wxComboBox::GetEditHWND() const
Remove(from, to);
// Now replace with 'value', by pasting.
- wxSetClipboardData(wxDF_TEXT, (wxObject *)(const wxChar *)value, 0, 0);
+ wxSetClipboardData(wxDF_TEXT, (wxObject *)value.wx_str(), 0, 0);
// Paste into edit control
SendMessage(GetHwnd(), WM_PASTE, (WPARAM)0, (LPARAM)0L);
void wxComboBox::OnUpdateDelete(wxUpdateUIEvent& event)
{
- event.Enable(HasSelection() && IsEditable());
+ event.Enable(IsEditable() && HasSelection());
}
void wxComboBox::OnUpdateSelectAll(wxUpdateUIEvent& event)
{
- event.Enable(GetLastPosition() > 0);
+ event.Enable(IsEditable() && GetLastPosition() > 0);
}
#endif // wxUSE_COMBOBOX