Subject |
Author |
Date |
|
Johannes Schwenk
|
Sep 18, 2008 - 7:42 AM
|
Hi,
i have the following Problem:
I have a CExtGridCellCombobox Derived Class, with Name CAdoDataCell_Combobox. This Class has a Private Member Var: CString m_sTest
The Cell is initialised in the RsCacheRow Function of the DataProvider:
CAdoDataCell_Combobox _cellAdoCombobox( m_pOther );
_cellAdoCombobox.SetCustomText ("TEST"); //Sets the m_sTest Var of the CAdoDataCell_Combobox Class
_cellAdoCombobox.ModifyStyle(__EGCS_NO_INPLACE_CONTROL);
VERIFY(
m_pOther->CellRangeSet(
nColNo + nCacheColOffset,
nCacheRowNo,
1,
1,
&_cellAdoCombobox,
false,
RUNTIME_CLASS(CAdoDataCell_Combobox)
)
);
Now i want to get the Value of m_sTest in the overided Function OnPopupListBoxItemClick of the CAdoDataCell_Combobox class. But the Value of m_sTest is always "", and not "TEST" as I set it in my SetCustomText Function.
What am I do Wrong?
Thanks for your Help,
Joschwenk
|
|
Technical Support
|
Sep 25, 2008 - 12:49 PM
|
|
|
Johannes Schwenk
|
Sep 22, 2008 - 5:36 AM
|
Ok, here is my CUstom Cell Class:
class AFX_EXT_CLASS CAdoDataCell_Combobox : public CExtGridCellComboBox {
private:
CString m_sTest;
public:
DECLARE_DYNCREATE( CAdoDataCell_Combobox );
IMPLEMENT_ExtGridCell_Clone( CAdoDataCell_Combobox, CExtGridCellCombobox);
//* Konstruktor / Destruktor *
CAdoDataCell_Combobox(CExtGridDataProvider * pDataProvider = NULL) : CExtGridCellComboBox( pDataProvider )
{
}
//* Sonstige Funktionen *
void SetCustomText () {
m_sTest = "TEST";
}
virtual bool OnPopupListBoxItemClick (
CExtPopupInplaceListBox & wndListBox,
CExtGridCell::TrackCellStateInfo_t & _tcsi
)
{
AfxMessageBox(m_sTest); //Allways "", not "TEST"
return CExtGridCell::OnPopupListBoxItemClick(wndListBox, _tcsi);
}
In my CExtGridWnd Derived Class Code I use
IMPLEMENT_DYNCREATE( CAdoDataCell_Combobox, CExtGridCellCombobox ); because when I add IMPLEMENT_DYNCREATE( CAdoDataCell_Combobox, CExtGridCell ); the Comboboxes in My Grid are always disabled (The Comobobox Button is disabled and no Values are shown in the Field)
Thanks for your Help,
Johannes Schwenk
|
|
Johannes Schwenk
|
Sep 20, 2008 - 6:44 AM
|
Ok, here is my CUstom Cell Class:
class
AFX_EXT_CLASS CAdoDataCell_Combobox : public CExtGridCellComboBox
private
CString m_sTest; :
public
DECLARE_DYNCREATE( CAdoDataCell_Combobox );
IMPLEMENT_ExtGridCell_Clone( CAdoDataCell_Combobox, CExtGridCellCombobox);
://* Konstruktor / Destruktor *
CAdoDataCell_Combobox(
CExtGridDataProvider * pDataProvider = NULL
)
: CExtGridCellComboBox( pDataProvider )
{
}
//* Sonstige Funktionen *
void SetCustomText () {m_sTest = "TEST";
}
CExtPopupInplaceListBox & wndListBox,
CExtGridCell::TrackCellStateInfo_t & _tcsi
)
{
AfxMessageBox("m_sTest"); //Always "", not "TEST"
return CExtGridCell::OnPopupListBoxItemClick(wndListBox, _tcsi);
virtual bool OnPopupListBoxItemClick (} } In my CExtGridWnd Derived Class Code
IMPLEMENT_DYNCREATE( CAdoDataCell_Combobox, CExtGridCellCombobox );
because when I add
IMPLEMENT_DYNCREATE( CAdoDataCell_Combobox, CExtGridCell );
the Comboboxes in My Grid are always disabled (The Comobobox Button is disabled and no Values are shown in the Field) Thanks for your Help, Johannes Schwenk {
|
|
Technical Support
|
Sep 22, 2008 - 7:45 AM
|
You may have forgotten to implement the CExtGridCell::Assign() virtual method which should detect whether the grid cell is assigned from the same type of grid cell and copy all the required properties.
|
|
Technical Support
|
Sep 18, 2008 - 12:18 PM
|
|
|
Johannes Schwenk
|
Sep 22, 2008 - 5:36 AM
|
Ok, here is my CUstom Cell Class:
class AFX_EXT_CLASS CAdoDataCell_Combobox : public CExtGridCellComboBox {
private:
CString m_sTest;
public:
DECLARE_DYNCREATE( CAdoDataCell_Combobox );
IMPLEMENT_ExtGridCell_Clone( CAdoDataCell_Combobox, CExtGridCellCombobox);
//* Konstruktor / Destruktor *
CAdoDataCell_Combobox(CExtGridDataProvider * pDataProvider = NULL) : CExtGridCellComboBox( pDataProvider )
{
}
//* Sonstige Funktionen *
void SetCustomText () {
m_sTest = "TEST";
}
virtual bool OnPopupListBoxItemClick (
CExtPopupInplaceListBox & wndListBox,
CExtGridCell::TrackCellStateInfo_t & _tcsi
)
{
AfxMessageBox(m_sTest); //Allways "", not "TEST"
return CExtGridCell::OnPopupListBoxItemClick(wndListBox, _tcsi);
}
In my CExtGridWnd Derived Class Code I use
IMPLEMENT_DYNCREATE( CAdoDataCell_Combobox, CExtGridCellCombobox ); because when I add IMPLEMENT_DYNCREATE( CAdoDataCell_Combobox, CExtGridCell ); the Comboboxes in My Grid are always disabled (The Comobobox Button is disabled and no Values are shown in the Field)
Thanks for your Help,
Johannes Schwenk
|
|
Technical Support
|
Sep 22, 2008 - 7:46 AM
|
First of all, please implement the CExtGridCell::Assign() virtual method which should detect whether the grid cell is assigned from the same cell type, copy properties of your class and invoke the parent class method finally.
The drop-down arrow can be disabled if:
- The __EGCS_READ_ONLY basic cell style is applied to the grid cell;
- The __EGCS_EX_BUTTON_DROPDOWN_DISABLED extended cell style is applied to the grid cell;
- The CExtGridCellComboBox::OnQueryButtonInfo() virtual method force disables drop down button because the count of strings inserted into combo box cell is zero;
The last reason is the most common.
|
|
Johannes Schwenk
|
Sep 23, 2008 - 4:24 AM
|
Now the Assign Function is Integrated, and my CAdoDataCell_Combobox Cell class looks like that: class AFX_EXT_CLASS CAdoDataCell_Combobox : public CExtGridCellComboBox
{
private:
CStringArray m_arrsCustomItemdata;
long* m_arrlCustomItemdata;
CString m_sTest;
public:
DECLARE_DYNCREATE( CAdoDataCell_Combobox );
IMPLEMENT_ExtGridCell_Clone( CAdoDataCell_Combobox, CExtGridCellComboBox);
//* Konstruktor / Destruktor *
CAdoDataCell_Combobox(
CExtGridDataProvider * pDataProvider = NULL
)
: CExtGridCellComboBox( pDataProvider )
{
}
//* Sonstige Funktionen *
void SetCustomItemData () {
m_sTest = "TEST";
}
virtual bool OnPopupListBoxItemClick (
CExtPopupInplaceListBox & wndListBox,
CExtGridCell::TrackCellStateInfo_t & _tcsi
)
{
AfxMessageBox(m_sTest) //Always NULL
return CExtGridCell::OnPopupListBoxItemClick(wndListBox, _tcsi);
}
virtual void Assign( const CExtGridCell & other )
{
CExtGridCellComboBox::Assign( other );
}
}; // class CAdoDataCell_Combobox And in my CPP File I use: IMPLEMENT_DYNCREATE( CAdoDataCell_Combobox, CExtGridCellComboBox ); Because When I use IMPLEMENT_DYNCREATE( CAdoDataCell_Combobox, CExtGridCell ); or When I call CExtGridCell::Assign( other ); in my Assign Function, the Combobox in my Grid is always not enabled, even if I explicit call
_cellAdoCombobox.ModifyStyle(0, __EGCS_READ_ONLY);
_cellAdoCombobox.ModifyStyleEx(0, __EGCS_EX_BUTTON_DROPDOWN_DISABLED);
and insert strings to the combobox with:
_cellAdoCombobox.InsertString(sShow);
As said Before: When I use the IMPLEMENT DYNCREATE and the Assign Function with the CExtGridCellComboBox Class, the Combobox is shown correctly...
What else can be wrong?
|
|
Technical Support
|
Sep 24, 2008 - 5:05 AM
|
We would be happy not to make unreasonable guesses. Could you please modify our AdoRecordsetView sample application by adding your combo box class and other needed code and send it to us? It would be also really helpful to get a small Access database which we should use when testing the modified sample application.
|
|
Johannes Schwenk
|
Sep 24, 2008 - 7:03 AM
|
Hi, www.leavemusic.de/live/publicshare/johannes/AdoRecordsetView.rar here you can Download the Sample with the CAdoDataCell_Combobox class in it. But the COmboboxes Are not shown, and I don’ßt know why. But you should be able to fix this fast...I customized Code in the RsCacheRow of the DataProvider Class, and I added my CAdoDataCell_Combobox Class. Thank you very much.
|
|
Technical Support
|
Oct 2, 2008 - 5:13 AM
|
|
|
Johannes Schwenk
|
Oct 9, 2008 - 8:22 AM
|
Thank you very much! Now it works fine!
|
|
Johannes Schwenk
|
Sep 30, 2008 - 7:08 AM
|
Hi, did it work? Please help me, I need to finish the Grid ASAP and I need to fix this bug. Thank You
|