Search

Copy/Paste is not working in dockable pane by aroone

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)
0
User(s) can reproduce this bug
Copy/Paste is not working in controls embeded into dockable pane by using keyboard accelerators (Ctrl/Shift-Ins, Ctrl-C, Ctrl-V)
Details (expand)

Visual Studio/Silverlight/Tooling version

Visual Studio 2010

What category (if any) best represents this feedback?

Reliability

Steps to reproduce

Start WordPad from VC2010 Feature Pack samples folder
Copy any text into clipboard (e.g. from the notepad)
Select "Custom page" in "Tasks" pane
Click with a mouse inside edit control
1) Paste with keyboard (Shift-Ins, Ctrl-V) copied text into "Enter your text" control
2) Select text in edit control and try to copy it using keyboard (Ctrl-Ins, Ctrl-C)

Product Language

English

Operating System

Windows 7

Operating System Language

English

Actual results

1) Text is pasted into the document instead of edit control
2) Nothing happens when text selected in edit control is copied with keyboard

Expected results

1) Text should be pasted into edit control
2) Selected text should be copied into clipboard
File Attachments
0 attachments
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.