Print Page | Close Window

TreeCtrl & EditControl & Acceleator Keya

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=1269
Printed Date: 06 November 2025 at 2:06pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: TreeCtrl & EditControl & Acceleator Keya
Posted By: jimmy
Subject: TreeCtrl & EditControl & Acceleator Keya
Date 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);
}




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net