class CMyClass : public Dapfor::Common::CDataObject
{
public:
enum
{
FidPrice,
FidQuantity,
FidTime,
};
public:
CMyClass(double price, __int64 quantity, long time);
virtual ~CMyClass();
double GetPrice() const;
__int64 GetQuantity() const;
long GetTime() const;
private:
double m_Price;
__int64 m_Quantity;
long m_Time;
DF_DECLARE_FIELD_MAP();
};
CMyClass::CMyClass(double price, __int64 quantity, long time)
: m_Price(price)
, m_Quantity(quantity)
, m_Time(time)
{
}
CMyClass::~CMyClass()
{
NotifyDelete();
}
DF_BEGIN_FIELD_MAP(CMyClass)
DF_DOUBLE_ID(FidPrice, "Price", &CMyClass::GetPrice, 0, 0)
DF_INT64_ID (FidQuantity, "Quantity", &CMyClass::GetQuantity, 0, 0)
DF_LONG_ID (FidTime, "Time", &CMyClass::GetTime, 0, new CLongDateFormat(CLongDateFormat::date))
DF_END_FIELD_MAP()
double CMyClass::GetPrice() const
{
return m_Price;
}
__int64 CMyClass::GetQuantity() const
{
return m_Quantity;
}
long CMyClass::GetTime() const
{
return m_Time;
}
...
Dapfor::GUI::CHeader* header = new Dapfor::GUI::CHeader();
header->Add(new Dapfor::GUI::CColumn(CMyClass::FidPrice, "Price", 100));
header->Add(new Dapfor::GUI::CColumn(CMyClass::FidQuantity, "Quantity", 100));
header->Add(new Dapfor::GUI::CColumn(CMyClass::FidTime, "Time", 100));
m_Grid.SetHeader(header);
...
CMyClass* obj1 = new CMyClass(12.34, 100, Dapfor::Common::CLongDateFormat::Now());
m_Grid.Add(obj1);
...