Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - TreeCtrl & EditControl & Acceleator Keya
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

TreeCtrl & EditControl & Acceleator Keya

 Post Reply Post Reply
Author
Message
jimmy View Drop Down
Senior Member
Senior Member


Joined: 11 November 2003
Location: Austria
Status: Offline
Points: 516
Post Options Post Options   Thanks (0) Thanks(0)   Quote jimmy Quote  Post ReplyReply Direct Link To This Post Topic: TreeCtrl & EditControl & Acceleator Keya
    Posted: 12 October 2004 at 10:21am
The TreeCtrl don't handle accelerator key.
If i was in the edit-control of the treectrl and press a accelerator key, no
accelerator message will received to the mainframe.

BOOL CXTTreeBase::PreTranslateMessage(MSG* pMsg)
{
    if (pMsg->message == WM_KEYDOWN)
    {
        // ensure that keystrokes are handled by the edit control.
        if (HasEditLabels() && m_pTreeCtrl->GetEditControl())
        {
            ::TranslateMessage(pMsg);
            ::DispatchMessage(pMsg);

            return TRUE;
        }

        // toggle expand / contract when return key is hit.
        if (pMsg->wParam == VK_RETURN)
        {
            HTREEITEM htItem = m_pTreeCtrl->GetSelectedItem();
            if (htItem != NULL)
            {
                m_pTreeCtrl->Expand(htItem, TVE_TOGGLE);
            }
        }
    }

    return m_pTreeCtrl->CTreeCtrl::PreTranslateMessage(pMsg);
}

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.047 seconds.