我用CGridCtrl创建了个电子表格。接入口是CGridCtrl* m_pGridCtrl;表格创建完成后,表格内显示一个数组内的数值,并且可以更改表格内的数据。我现在的问题是想把更改的数据重新存起来,可是我怎么样才知道数据被更改了呢?
我看网上说BOOL IsItemEditing(int nRow, int nCol) 如果单元格处于编辑状态,则返回TRUE.可是我还是不太明白,不会用啊。我想着是不是应该有一个消息发出,然后我写个消息响应函数呢?
希望能有人给我讲一下谢谢
我看网上说BOOL IsItemEditing(int nRow, int nCol) 如果单元格处于编辑状态,则返回TRUE.可是我还是不太明白,不会用啊。我想着是不是应该有一个消息发出,然后我写个消息响应函数呢?
希望能有人给我讲一下谢谢
LRESULT* pResult)
{
NM_GRIDVIEW* pItem = (NM_GRIDVIEW*) pNotifyStruct;
// AcceptChange is a fictional routine that should return TRUE
// if you want to accept the new value for the cell.
BOOL bAcceptChange = mf_AcceptChange(pItem->hdr.hwndFrom, pItem->iRow, pItem->iColumn);
*pResult = (bAcceptChange)? 0 : -1;
}BOOL mf_AcceptChange(HWND hWnd, int nRow, int nCol)
{
CString strValue = _T("");
//你的处理。 return TRUE;
}
我是这么创建的
CGridCtrl* m_pGridCtrl;
-----------------------
m_pGridCtrl = new CGridCtrl;
CRect rect;
GetClientRect(rect);
m_pGridCtrl->Create(rect, this, 100);
我看资料里说的是这么创建的
CGridCtrl grid;
grid.Create(rect, pParentWnd, nID);
其中的rect是大小,pParentWnd是父窗口,nID是标志符。
很迷惑,请讲一下,谢谢~
可以啊, 自定义一个变量就行了。
比如: #define IDC_GRID 1000m_pGridCtrl->Create(rect, this, IDC_GRID);ON_NOTIFY(GVN_ENDLABELEDIT, IDC_GRID, OnGridEndEdit)