Print Page | Close Window

BUG?: CXTTreeCtrl beeps when pressing VK_RETURN

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=12794
Printed Date: 18 May 2024 at 12:38pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: BUG?: CXTTreeCtrl beeps when pressing VK_RETURN
Posted By: mgampi
Subject: BUG?: CXTTreeCtrl beeps when pressing VK_RETURN
Date Posted: 25 November 2008 at 10:05am
Hi;
This can be seen in toolkit TreeCtrl sample too:

When pressing the ENTER key (VK_RETURN) while a parent node is selected, the expansion state changes, but also a system beep occures (not handled SYSKEYS; e.g. accelerators lead to system sounds)!

I think that CXTTreeBase::PreTranslateMessage() should be changed as shown below (Oleg, could you apply this?):

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 TRUE;
            }
        }
    }

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


I'm using toolkit version 12.0.1, VC++ 7.1...



-------------
Martin

Product: Xtreme Toolkit v 19.0.0, new Projects v 19.1.0
Platform: Windows 10 v 1909 (64bit)
Language: VC++ 2017



Replies:
Posted By: Oleg
Date Posted: 26 November 2008 at 3:13am
Hi,
 
Thanks. changed.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: Alex H.
Date Posted: 31 March 2009 at 7:18am
< ="Content-" content="text/; charset=utf-8">< name="ProgId" content="Word.">< name="Generator" content="Microsoft Word 12">< name="Originator" content="Microsoft Word 12"><>

This adoptions leads to a changed behaviour and breaks existing code for handling VK_ENTER in any TVN_KEYDOWN handler by the application! TVN_KEYDOWN now is not triggered anymore for VK_ENTER as it's eaten up by this change.

 

Any suggestions?

 



Posted By: Oleg
Date Posted: 01 April 2009 at 1:11am
Hello,
 
Please override CXTTreeCtrl/View override PreTranslateMessage and call CWnd::PreTranslateMessage.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: XPOHuK
Date Posted: 23 April 2009 at 5:04am
Note, that TVN_ITEMEXPANDING notification is not sent when expanding or collapsing using Enter key.



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