Added insertion point code to wxComboBox
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@7822 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -366,54 +366,46 @@ void wxComboBox::SetEditable(bool editable)
|
|||||||
|
|
||||||
void wxComboBox::SetInsertionPoint(long pos)
|
void wxComboBox::SetInsertionPoint(long pos)
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
HWND hWnd = GetHwnd();
|
|
||||||
#ifdef __WIN32__
|
#ifdef __WIN32__
|
||||||
SendMessage(hWnd, EM_SETSEL, pos, pos);
|
HWND hWnd = GetHwnd();
|
||||||
SendMessage(hWnd, EM_SCROLLCARET, (WPARAM)0, (LPARAM)0);
|
SendMessage(hWnd, CB_SETEDITSEL, 0, MAKELPARAM(pos, pos));
|
||||||
#else
|
HWND hEditWnd = (HWND) GetEditHWND() ;
|
||||||
SendMessage(hWnd, EM_SETSEL, 0, MAKELPARAM(pos, pos));
|
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
|
#endif
|
||||||
char *nothing = "";
|
|
||||||
SendMessage(hWnd, EM_REPLACESEL, 0, (LPARAM)nothing);
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxComboBox::SetInsertionPointEnd()
|
void wxComboBox::SetInsertionPointEnd()
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
long pos = GetLastPosition();
|
long pos = GetLastPosition();
|
||||||
SetInsertionPoint(pos);
|
SetInsertionPoint(pos);
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
long wxComboBox::GetInsertionPoint() const
|
long wxComboBox::GetInsertionPoint() const
|
||||||
{
|
{
|
||||||
/*
|
#ifdef __WIN32__
|
||||||
DWORD Pos=(DWORD)SendMessage(GetHwnd(), EM_GETSEL, 0, 0L);
|
DWORD Pos=(DWORD)SendMessage(GetHwnd(), CB_GETEDITSEL, 0, 0L);
|
||||||
return Pos&0xFFFF;
|
return Pos&0xFFFF;
|
||||||
*/
|
#else
|
||||||
return 0;
|
return 0;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
long wxComboBox::GetLastPosition() const
|
long wxComboBox::GetLastPosition() const
|
||||||
{
|
{
|
||||||
/*
|
HWND hEditWnd = (HWND) GetEditHWND();
|
||||||
HWND hWnd = GetHwnd();
|
|
||||||
|
|
||||||
// Will always return a number > 0 (according to docs)
|
// Get number of characters in the last (only) line. We'll add this to the character
|
||||||
int noLines = (int)SendMessage(hWnd, EM_GETLINECOUNT, (WPARAM)0, (LPARAM)0L);
|
|
||||||
|
|
||||||
// This gets the char index for the _beginning_ of the last line
|
|
||||||
int charIndex = (int)SendMessage(hWnd, EM_LINEINDEX, (WPARAM)(noLines-1), (LPARAM)0L);
|
|
||||||
|
|
||||||
// Get number of characters in the last line. We'll add this to the character
|
|
||||||
// index for the last line, 1st position.
|
// index for the last line, 1st position.
|
||||||
int lineLength = (int)SendMessage(hWnd, EM_LINELENGTH, (WPARAM)charIndex, (LPARAM)0L);
|
int lineLength = (int)SendMessage(hEditWnd, EM_LINELENGTH, (WPARAM) 0, (LPARAM)0L);
|
||||||
|
|
||||||
return (long)(charIndex + lineLength);
|
return (long)(lineLength);
|
||||||
*/
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxComboBox::Replace(long from, long to, const wxString& value)
|
void wxComboBox::Replace(long from, long to, const wxString& value)
|
||||||
|
Reference in New Issue
Block a user