Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - ComboBox in Toolbar - not calling OnSelChanged()
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

ComboBox in Toolbar - not calling OnSelChanged()

 Post Reply Post Reply
Author
Message
tralfaz View Drop Down
Groupie
Groupie


Joined: 21 June 2009
Status: Offline
Points: 36
Post Options Post Options   Thanks (0) Thanks(0)   Quote tralfaz Quote  Post ReplyReply Direct Link To This Post Topic: ComboBox in Toolbar - not calling OnSelChanged()
    Posted: 01 July 2009 at 6:47pm
I added a derived ComboBox to a toolbar. The OnSelChanged virtual function is not being called after the dropdown closes up. Am I missing a flag? Is there still no way for MainFrm to be notified when a ComboBox changes?

//.h
class XComboBox: public CXTPControlComboBox
{
public:
    XComboBox(CXTPCommandBars* pCommandBars = NULL);

    // ClassWizard generated virtual function overrides
    //{{AFX_VIRTUAL(XComboBox)
    public:
        virtual void OnSelChanged();
    //}}AFX_VIRTUAL

};

//.cpp
XComboBox::XComboBox(CXTPCommandBars* pCommandBars)
: CXTPControlComboBox(pCommandBars)
{
}

void XComboBox::OnSelChanged()
{
    int index = this->GetCurSel();
    CString text;
    this->GetLBText(index, text);
    AfxMessageBox(text);
}

//MainFrm.cpp
int CMainFrame::OnCreateControl(LPCREATECONTROLSTRUCT lpCreateControl)
{
    if (lpCreateControl->bToolBar)
    {
        if (lpCreateControl->nID == IDC_FONTCOMBO)
        {
            XComboBox* pCB = new XComboBox(GetCommandBars());
            lpCreateControl->pControl = pCB;
            return true;
        }
    }

    return 0;
}

XP Pro SP3 / VS2008 C++ / Xtreme CommandBars v13.1.0
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: 06 July 2009 at 1:30am
Hi,
 
So did you actually change selection or just open and close it ?
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
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.139 seconds.