]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/combobox.cpp
Fix various minor PS issues
[wxWidgets.git] / src / msw / combobox.cpp
index fca1afd0cacb3b1606eb1ea7cdff5e81916cb4ae..8ced0946381fcc14b0a3a5e15a6477582dcb3196 100644 (file)
@@ -326,7 +326,7 @@ bool wxComboBox::MSWCommand(WXUINT param, WXWORD id)
             // 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());
@@ -367,6 +367,30 @@ bool wxComboBox::MSWCommand(WXUINT param, WXWORD 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
 {
     // this function should not be called for wxCB_READONLY controls, it is
@@ -656,7 +680,7 @@ void wxComboBox::Replace(long from, long to, const wxString& value)
     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);
@@ -775,12 +799,12 @@ void wxComboBox::OnUpdateRedo(wxUpdateUIEvent& event)
 
 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