Fixed some bugs in new code (CanPaste, GetSelection)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2057 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart 1999-04-06 20:26:41 +00:00
parent 966a3b2cc6
commit b80ec6db89

View File

@ -747,8 +747,24 @@ bool wxTextCtrl::CanCut() const
bool wxTextCtrl::CanPaste() const
{
int dataFormat = 0; // 0 == any format
return (::SendMessage( (HWND) GetHWND(), EM_CANPASTE, (WPARAM) (UINT) dataFormat, 0) != 0);
#if wxUSE_RICHEDIT
if (m_isRich)
{
int dataFormat = 0; // 0 == any format
return (::SendMessage( (HWND) GetHWND(), EM_CANPASTE, (WPARAM) (UINT) dataFormat, 0) != 0);
}
#endif
if (!IsEditable())
return FALSE;
// Standard edit control: check for straight text on clipboard
bool isTextAvailable = FALSE;
if (::OpenClipboard((HWND) wxTheApp->GetTopWindow()->GetHWND()))
{
isTextAvailable = (::IsClipboardFormatAvailable(CF_TEXT) != 0);
::CloseClipboard();
}
return isTextAvailable;
}
// Undo/redo
@ -796,8 +812,8 @@ void wxTextCtrl::GetSelection(long* from, long* to) const
}
#endif
DWORD dwStart, dwEnd;
WPARAM wParam = (WPARAM) (DWORD*) dwStart; // receives starting position
LPARAM lParam = (LPARAM) (DWORD*) dwEnd; // receives ending position
WPARAM wParam = (WPARAM) (DWORD*) & dwStart; // receives starting position
LPARAM lParam = (LPARAM) (DWORD*) & dwEnd; // receives ending position
::SendMessage((HWND) GetHWND(), EM_GETSEL, wParam, lParam);