merged fix from 2.2 branch

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@8914 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2000-12-12 14:33:15 +00:00
parent bdce924e12
commit 6d14cac77d

View File

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