c++ - How do I get my subclassed combo box messages to forward their messages to the parent toolbar? -
i have 5 combo boxes on toolbar , want process messages , notification , particularly cbn_selchange notification int subclassed toolbar class. have tried several approaches no avail. deinition of tool bar , combo box classes shown below:
#pragma once // cmycombobox class cmycombobox : public ccombobox { declare_dynamic(cmycombobox) public: cmycombobox(); virtual ~cmycombobox(); protected: declare_message_map() public: afx_msg bool oncbnselchange(); //afx_msg void oncbnselchange(); }; // mycombobox.cpp : implementation file // #include "stdafx.h" #include "mycombobox.h" implement_dynamic(cmycombobox, ccomboboxex) cmycombobox::cmycombobox() { } cmycombobox::~cmycombobox() { } begin_message_map(cmycombobox, ccomboboxex) //on_control_reflect(cbn_selchange, &cmycombobox::oncbnselchange) on_control_reflect_ex(cbn_selchange, &cmycombobox::oncbnselchange) end_message_map() // cmycombobox message handlers bool cmycombobox::oncbnselchange() { return false; } #pragma once #include "mystatic.h" #include "mycombobox.h" // mytoolbar class cmytoolbar : public cmfctoolbar { declare_dynamic(cmytoolbar) public: cmytoolbar(); virtual ~cmytoolbar(); public: void embedcontrols(); //cmystatic m_pstatic3; cmycombobox m_combo1,m_combo2,m_combo3,m_combo4,m_combo5; cwnd m_pedit1; cfont m_font; private: public: afx_msg void oncbnselchange1(); afx_msg void oncbnselchange2(); afx_msg void oncbnselchange3(); afx_msg void oncbnselchange4(); afx_msg void oncbnselchange5(); protected: declare_message_map() //public: //afx_msg void onsize(uint ntype, int cx, int cy); }; implement_dynamic(cmytoolbar, cmfctoolbar) cmytoolbar::cmytoolbar() { } cmytoolbar::~cmytoolbar() { } begin_message_map(cmytoolbar, cmfctoolbar) on_cbn_selchange(id_combo1, &cmytoolbar::oncbnselchange1) on_cbn_selchange(id_combo2, &cmytoolbar::oncbnselchange2) on_cbn_selchange(id_combo3, &cmytoolbar::oncbnselchange3) on_cbn_selchange(id_combo4, &cmytoolbar::oncbnselchange4) on_cbn_selchange(id_combo5, &cmytoolbar::oncbnselchange5) //on_wm_size() end_message_map() // mytoolbar message handlers #include "stdafx.h" #include "mytoolbar.h" void cmytoolbar::oncbnselchange1() { //operation1 } void cmytoolbar::oncbnselchange2() { //operation1 } void cmytoolbar::oncbnselchange2() { //operation2 } void cmytoolbar::oncbnselchange3() { //operation3 } void cmytoolbar::oncbnselchange4() { //operation4 } void cmytoolbar::oncbnselchange5() { //operation5 } void cmytoolbar:embedcontrols() { //creates 5 comboboxes of type mycombobox , embeds on tool bar }
the problem neither of operations 1 4 being carried out signifying selection change messages not reaching toolbar. stepping code @ runtime confirm this.
so, how combo boxes forward messages toolbar processiing?
Comments
Post a Comment