|
|
|
|
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.
Subject |
Author |
Date |
|
Mac Will
|
Apr 10, 2006 - 11:36 AM
|
Hello,
I am trying to make a custom cell based on CExtGridCellDropListComboBox. For some reason it complains on compiling when I use the IMPLEMENT_DYNCREATE macro?
Any thoughts?
Also how do I intercept the selection changes of the combo box?
Thanks
|
|
Mac Will
|
Apr 11, 2006 - 10:49 AM
|
Thanks!
I guess sometimes when you are looking at your ow code all day you get blurry eyed.
M
|
|
Mac Will
|
Apr 10, 2006 - 12:37 PM
|
I should add:
1) I understand the last error and I removed the propertyItem initialization and I still get the other errors
2) If I remove DECLARE_DYNCREATE and IMPLEMENT_DYNCREATE it compiles and works I just can’t seem to intercept OnPopupListBoxSelEndOK()
|
|
Technical Support
|
Apr 11, 2006 - 8:57 AM
|
Please ensure that you overrode OnPopupListBoxSelEndOK() in this way:
// *.h file:
virtual bool OnPopupListBoxSelEndOK(
CExtPopupInplaceListBox & wndListBox,
CExtGridCell::TrackCellStateInfo_t & _tcsi
);
// *.cpp file:
bool PropertyItemRequestCellCombo::OnPopupListBoxSelEndOK(
CExtPopupInplaceListBox & wndListBox,
CExtGridCell::TrackCellStateInfo_t & _tcsi
)
{
ASSERT_VALID( this );
ASSERT( (&_tcsi.m_cell) == this );
ASSERT_VALID( (&wndListBox) );
ASSERT_VALID( (&_tcsi.m_wndGrid) );
CExtGridCellDropListComboBox::OnPopupListBoxSelEndOK(
wndListBox,
_tcsi
);
// place your code
return false;
}
|
|
Mac Will
|
Apr 10, 2006 - 12:33 PM
|
Hmm... This didn’t seem to work? I am not sure what is going on here are the exact details:
//------------------ // Header file //------------------ #pragma once
class PropertyItemRequestCellCombo : public CExtGridCellDropListComboBox { public:
DECLARE_DYNCREATE( PropertyItemRequestCellComboCombo ); IMPLEMENT_ExtGridCell_Clone( PropertyItemRequestCellCombo, CExtGridCellDropListComboBox );
PropertyItemRequestCellCombo(CExtGridDataProvider * pDP = NULL); ~PropertyItemRequestCellCombo(void);
};
//------------------ // CPP file //------------------
#include "StdAfx.h" #include ".\PropertyItemRequestCellCombo.h"
IMPLEMENT_DYNCREATE(PropertyItemRequestCellCombo, CExtGridCellDropListComboBox );
PropertyItemRequestCellCombo::PropertyItemRequestCellCombo(CExtGridDataProvider * pDP) : CExtGridCellDropListComboBox( pDP ), propertyItem(NULL) { }
PropertyItemRequestCellCombo::~PropertyItemRequestCellCombo(void) { }
//------------------------------------------------ //------------------------------------------------ And when I compile (VS .net) I get the following errors:
PropertyItemRequestCellCombo.cpp(6) : error C2039: ’classPropertyItemRequestCellCombo’ : is not a member of ’PropertyItemRequestCellCombo’ PropertyItemRequestCellCombo.h(5) : see declaration of ’PropertyItemRequestCellCombo’ PropertyItemRequestCellCombo.cpp(6) : error C2496: ’classPropertyItemRequestCellCombo’ : ’selectany’ can only be applied to data items with external linkage PropertyItemRequestCellCombo.cpp(6) : error C2039: ’classPropertyItemRequestCellCombo’ : is not a member of ’PropertyItemRequestCellCombo’ PropertyItemRequestCellCombo.h(5) : see declaration of ’PropertyItemRequestCellCombo’ PropertyItemRequestCellCombo.cpp(6) : error C2039: ’classPropertyItemRequestCellCombo’ : is not a member of ’PropertyItemRequestCellCombo’ PropertyItemRequestCellCombo.h(5) : see declaration of ’PropertyItemRequestCellCombo’ PropertyItemRequestCellCombo.cpp(11) : error C2614: ’PropertyItemRequestCellCombo’ : illegal member initialization: ’propertyItem’ is not a base or member
|
|
Technical Support
|
Apr 11, 2006 - 8:52 AM
|
It seems the problem is trivial. There is a redundant "combo": DECLARE_DYNCREATE( PropertyItemRequestCellComboCombo ); In fact, it should be: DECLARE_DYNCREATE( PropertyItemRequestCellCombo );
|
|
Technical Support
|
Apr 10, 2006 - 12:19 PM
|
We know only one problem with IMPLEMENT_DYNCREATE and grid cells. This problem is caused by a conflict of C++ new operators defined locally in the CExtGridCell class. The solution is really easy. Please open the C++ file that implements your cell class and move the IMPLEMENT_DYNCREATE macro to the top of the file before the definition of the debug version of the new operator: #include "StdAfx.h"
. . .
IMPLEMENT_SERIAL(...
. . .
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
. . . As for the selection changed event, you need to override the OnPopupListBoxSelEndOK() virtual method, which is called to handle the final item selection changed event of the list box control in the popup menu tracked by the built-in button.
|
|
Mac Will
|
Apr 10, 2006 - 12:03 PM
|
This is my entire cell class:
#pragma once
class PropertyItem;
class PropertyItemRequestCellCombo : public CExtGridCellDropListComboBox { public:
DECLARE_DYNCREATE( PropertyItemRequestCellComboCombo ); IMPLEMENT_ExtGridCell_Clone( PropertyItemRequestCellCombo, CExtGridCellDropListComboBox );
PropertyItemRequestCellCombo(CExtGridDataProvider * pDP = NULL); ~PropertyItemRequestCellCombo(void);
void propertyItemSet(PropertyItem *thePropertyItem);
private: PropertyItem *propertyItem; };
//----------------------------------------------------------------- #include "StdAfx.h" #include ".\PropertyItemRequestCellCombo.h" #include "PropertyItem.h"
//IMPLEMENT_DYNCREATE(PropertyItemRequestCellCombo, CExtGridCellDropListComboBox );
PropertyItemRequestCellCombo::PropertyItemRequestCellCombo(CExtGridDataProvider * pDP) : CExtGridCellDropListComboBox( pDP ), propertyItem(NULL) { }
PropertyItemRequestCellCombo::~PropertyItemRequestCellCombo(void) { }
void PropertyItemRequestCellCombo::propertyItemSet(PropertyItem *thePropertyItem) { propertyItem = thePropertyItem; }
|
|