From: Julian Smart Date: Tue, 6 Apr 1999 20:26:41 +0000 (+0000) Subject: Fixed some bugs in new code (CanPaste, GetSelection) X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/b80ec6db893bc3663dd6d6802ccb8c2d85c1ef97 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 --- diff --git a/src/msw/textctrl.cpp b/src/msw/textctrl.cpp index d08a18f028..2642a90de4 100644 --- a/src/msw/textctrl.cpp +++ b/src/msw/textctrl.cpp @@ -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);