- SendMessage(hWnd, EM_SETSEL, pos, pos);
- SendMessage(hWnd, EM_SCROLLCARET, (WPARAM)0, (LPARAM)0);
-#else
- SendMessage(hWnd, EM_SETSEL, 0, MAKELPARAM(pos, pos));
+ 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);
+ }