Home Dashboard Directory Help
Search

Copy/Paste is not working in dockable pane by aroone


Status: 

Closed
 as Fixed Help for as Fixed


1
0
Sign in
to vote
Type: Bug
ID: 632550
Opened: 12/20/2010 3:11:33 AM
Access Restriction: Public
0
Workaround(s)
view
0
User(s) can reproduce this bug

Description

Copy/Paste is not working in controls embeded into dockable pane by using keyboard accelerators (Ctrl/Shift-Ins, Ctrl-C, Ctrl-V)
Details
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)
Sign in to post a workaround.