Print Page | Close Window

ComboBox in Toolbar - not calling OnSelChanged()

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=14665
Printed Date: 22 June 2025 at 5:15am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: ComboBox in Toolbar - not calling OnSelChanged()
Posted By: tralfaz
Subject: ComboBox in Toolbar - not calling OnSelChanged()
Date 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



Replies:
Posted By: Oleg
Date 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



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