Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » CExtGridCellComboBox on selection change Collapse All
Subject Author Date
Darren Oliver Jan 25, 2007 - 7:38 AM

Dear Support,

I would like to be notified when the user selects an item from the CExtGridCellComboBox. I have followed your example in the FAQ here (http://www.prof-uis.com/FAQView.aspx?CID=107#FAQ537) but I am still not entering the OnPopupListBoxSelEndOK when the user makes a selection. I’m running v2.61.

Thanks, Have a great day!
Darren

I have
//.h
class MyGridCellComboBox :
    public CExtGridCellComboBox

virtual bool OnPopupListBoxSelEndOK(
        CExtPopupInplaceListBox & wndListBox,
        CExtGridCell::TrackCellStateInfo_t & _tcsi
        );

//.cpp
bool MyGridCellComboBox::OnPopupListBoxSelEndOK(
    CExtPopupInplaceListBox & wndListBox,
    CExtGridCell::TrackCellStateInfo_t & _tcsi
    )
{
    ASSERT_VALID( this );
    ASSERT( (&_tcsi.m_cell) == this );
    ASSERT_VALID( (&wndListBox) );
    ASSERT_VALID( (&_tcsi.m_wndGrid) );

    CExtGridCellComboBox::OnPopupListBoxSelEndOK(
        wndListBox,
        _tcsi
        );

    // place your code here

    return false;
}

Darren Oliver Jan 26, 2007 - 6:59 AM

Thank you Suhai Gyorgy for a very clear response. I have it working now because I was missing all the code in your response.

Have a great day and thanks again.

Suhai Gyorgy Jan 26, 2007 - 2:35 AM

The code above seems to be fine, but please also include the following codes:

In .h in your class declaration:

public:
	DECLARE_DYNCREATE( MyGridCellComboBox);
	IMPLEMENT_ExtGridCell_Clone( MyGridCellComboBox, CExtGridCellComboBox);
	MyGridCellComboBox(
		CExtGridDataProvider * pDP = NULL
		);
At the very top of your .cpp:
// moved to top (i.e. before DEBUG_NEW) to avoid
// conflict with MFC’s operator new
IMPLEMENT_DYNCREATE( MyGridCellComboBox, CExtGridCellComboBox);
 
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
 
 ... // any other code
 
MyGridCellComboBox::MyGridCellComboBox(
	CExtGridDataProvider * pDP // = NULL
	)
	: CExtGridCellComboBox( pDP )
{
}
To have the new cell used in your grid, use this code when initializing the grid:
	MyGridCellComboBox* pCellString =
		STATIC_DOWNCAST(
			MyGridCellComboBox,
			GridCellGet(nColNo, nRowNo, 0, 0, RUNTIME_CLASS(MyGridCellComboBox) )
			);
	... // other initializitions of the cell
You can see how its done in the SimpleGrids sample. Look for the class CDemoComboCell.