Copy/Paste is not working in dockable pane - by aroone

Status : 

  Fixed<br /><br />
		This item has been fixed in the current or upcoming version of this product.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.


1
0
Sign in
to vote
ID 632550 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 12/20/2010 3:11:33 AM
Access Restriction Public

Description

Copy/Paste is not working in controls embeded into dockable pane by using keyboard accelerators (Ctrl/Shift-Ins, Ctrl-C, Ctrl-V)
Sign in to post a comment.
Posted by Microsoft on 1/17/2011 at 1:59 PM
Hello,

Thanks for the report. This behavior is by design in MFC. All embedded docking pane keyboard accelerators must be implemented at the application level. You can do this by adding a PreTranslate method to the CTaskPane class, with the following implementation:

BOOL CTaskPane::PreTranslateMessage(MSG* pMsg)
{
    if (pMsg->message == WM_KEYDOWN)
    {
        CWnd* pWndFocus = CWnd::GetFocus();

        if (m_wndEdit.GetSafeHwnd() == pWndFocus->GetSafeHwnd())
        {
            // Process clipboard accelerators:
            UINT nChar = (UINT)pMsg->wParam;

            BOOL bIsCtrl = (::GetAsyncKeyState(VK_CONTROL) & 0x8000);
            BOOL bIsShift = (::GetAsyncKeyState(VK_SHIFT) & 0x8000);

            if (bIsCtrl && (nChar == _T('C') || nChar == VK_INSERT))
            {
                m_wndEdit.SendMessage(WM_COPY);
                return TRUE;
            }

            if (bIsCtrl && nChar == _T('V') || (bIsShift && nChar == VK_INSERT))
            {
                m_wndEdit.SendMessage(WM_PASTE);
                return TRUE;
            }

            if (bIsCtrl && nChar == _T('X') || (bIsShift && nChar == VK_DELETE))
            {
                m_wndEdit.SendMessage(WM_CUT);
                return TRUE;
            }

            if (bIsCtrl && (nChar == _T('A')))
            {
                m_wndEdit.SetSel(0, -1);
                return TRUE;
            }
        }
    }

    return CMFCTasksPane::PreTranslateMessage(pMsg);
}

I hope this helps with your scenario.

Pat Brenner
Visual C++ Libraries Development


Posted by Microsoft on 12/20/2010 at 3:21 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)