Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - How to catch ComboBox's messages
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

How to catch ComboBox's messages

 Post Reply Post Reply
Author
Message
yoshinaga View Drop Down
Newbie
Newbie


Joined: 13 February 2007
Location: Japan
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote yoshinaga Quote  Post ReplyReply Direct Link To This Post Topic: How to catch ComboBox's messages
    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.

How can I get notify when combo box changed selection?


Back to Top
Smucker View Drop Down
Senior Member
Senior Member
Avatar

Joined: 02 February 2008
Status: Offline
Points: 156
Post Options Post Options   Thanks (0) Thanks(0)   Quote Smucker Quote  Post ReplyReply Direct Link To This Post 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.

Back to Top
yoshinaga View Drop Down
Newbie
Newbie


Joined: 13 February 2007
Location: Japan
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote yoshinaga Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 16 May 2008 at 1:29am
Hi,
 
Check CustomThemes sampe. It has Combos and handlers.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Smucker View Drop Down
Senior Member
Senior Member
Avatar

Joined: 02 February 2008
Status: Offline
Points: 156
Post Options Post Options   Thanks (0) Thanks(0)   Quote Smucker Quote  Post ReplyReply Direct Link To This Post 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);
    }
}
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.063 seconds.