]> git.saurik.com Git - wxWidgets.git/commitdiff
merged fix from 2.2 branch
authorVadim Zeitlin <vadim@wxwidgets.org>
Tue, 12 Dec 2000 14:33:15 +0000 (14:33 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Tue, 12 Dec 2000 14:33:15 +0000 (14:33 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@8914 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/combobox.cpp

index cf839f4748e486aeb7e45c26f9710a6a8b9c6dd2..3caa1b324d7bd962406e0744e3e9b71f258b6006 100644 (file)
@@ -366,25 +366,31 @@ void wxComboBox::SetEditable(bool editable)
 
 void wxComboBox::SetInsertionPoint(long pos)
 {
+    if ( GetWindowStyle() & wxCB_READONLY )
+        return;
+
 #ifdef __WIN32__
-  HWND hWnd = GetHwnd();
-  SendMessage(hWnd, CB_SETEDITSEL, 0, MAKELPARAM(pos, pos));
-  HWND hEditWnd = (HWND) GetEditHWND() ;
-  if (hEditWnd)
-  {
-    // Scroll insertion point into view
-    SendMessage(hEditWnd, EM_SCROLLCARET, (WPARAM)0, (LPARAM)0);
-    // Why is this necessary? (Copied from wxTextCtrl::SetInsertionPoint)
-    static const wxChar *nothing = _T("");
-    SendMessage(hEditWnd, EM_REPLACESEL, 0, (LPARAM)nothing);
-  }
-#endif
+    HWND hWnd = GetHwnd();
+    ::SendMessage(hWnd, CB_SETEDITSEL, 0, MAKELPARAM(pos, pos));
+    HWND hEditWnd = (HWND) GetEditHWND() ;
+    if ( hEditWnd )
+    {
+        // Scroll insertion point into view
+        SendMessage(hEditWnd, EM_SCROLLCARET, (WPARAM)0, (LPARAM)0);
+        // Why is this necessary? (Copied from wxTextCtrl::SetInsertionPoint)
+        SendMessage(hEditWnd, EM_REPLACESEL, 0, (LPARAM)_T(""));
+    }
+#endif // __WIN32__
 }
 
 void wxComboBox::SetInsertionPointEnd()
 {
-  long pos = GetLastPosition();
-  SetInsertionPoint(pos);
+    // setting insertion point doesn't make sense for read only comboboxes
+    if ( !(GetWindowStyle() & wxCB_READONLY) )
+    {
+        long pos = GetLastPosition();
+        SetInsertionPoint(pos);
+    }
 }
 
 long wxComboBox::GetInsertionPoint() const