Print Page | Close Window

How to catch ComboBox's messages

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=10640
Printed Date: 01 March 2025 at 6:18am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: How to catch ComboBox's messages
Posted By: yoshinaga
Subject: How to catch ComboBox's messages
Date Posted: 15 May 2008 at 1:26pm
Hello,

A really silly question, but I don't know at all.
I have a combobox in command bars, created in CMainFrame::OnCreate like this,

    m_pComboYear = (CXTPControlComboBox*)m_pToolBar->GetControls()->Add(xtpControlComboBox,ID_YEAR);


I found ListBoxSample, but XTP_LBN_SELCHANGE is used for CXTPControlListBox.html - CXTPControlListBox .

How can I get notify when combo box changed selection?





Replies:
Posted By: Smucker
Date Posted: 15 May 2008 at 3:56pm
Here are the ones I'm using:

ON_NOTIFY(CBN_DROPDOWN, CMD_TREE_LOCATION, FillLocationCombo)
ON_XTP_EXECUTE(CMD_TREE_LOCATION, HandleLocationCombo)
HTH.



Posted By: yoshinaga
Date Posted: 15 May 2008 at 9:21pm
Hi, HTH

Can I have more hint ablout HandleLocationCombo, FillLocationCombo.

CMainFrame::HandleLocationCombo(NMHDR* pNMHDR, LRESULT* pResult)
but How can I now this event is occured for which reason?

Thanks a lot.


Posted By: Oleg
Date Posted: 16 May 2008 at 1:29am
Hi,
 
Check CustomThemes sampe. It has Combos and handlers.


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


Posted By: Smucker
Date Posted: 16 May 2008 at 1:42pm
For ON_NOTIFY, the CBN_* determines the event (drop down in this case, so I fill the list in FillLocationCombo).

ON_XTP_EXECUTE occurs when the selection is made (picked or typed).

You can get the control using:

CXTPControlComboBox *pcombo = (CXTPControlComboBox *)(((NMXTPCONTROL*)pnmh)->pControl)

Here is an example from my code:

afx_msg void CMainFrame::HandleLocationCombo(NMHDR* pnmh, LRESULT *pres)
{
    CXTPControlComboBox *pcombo = (CXTPControlComboBox *)(((NMXTPCONTROL*)pnmh)->pControl);
    if (pcombo) {
        ASSERT(pcombo->GetType() == xtpControlComboBox);
        CString foldername = pcombo->GetEditText();
        m_tree.PositionToFolder(foldername);
    }
}



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