-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathMeasGrid.cpp
53 lines (41 loc) · 1.36 KB
/
MeasGrid.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include "stdafx.h"
#include "resource.h"
#include "measgrid.h"
CMeasGrid::CMeasGrid(void)
{
parent = nullptr;
}
CMeasGrid::~CMeasGrid(void)
{
parent = nullptr;
}
BEGIN_MESSAGE_MAP(CMeasGrid, CGridCtrl)
ON_WM_CONTEXTMENU()
END_MESSAGE_MAP()
void CMeasGrid::OnContextMenu(CWnd* pWnd, CPoint point){
CMenu menu;
/* VERIFY(menu.LoadMenu(IDR_MENU1));
CMenu* pPopup = menu.GetSubMenu(0);
ASSERT(pPopup != nullptr);
CCellRange cellRange = GetSelectedCellRange();
int minRow = cellRange.GetMinRow() - 1;
int nRows = cellRange.GetRowSpan();
if(nRows <= 0){ // nothing selected
pPopup->EnableMenuItem(ID__INSERTROW, MF_DISABLED | MF_GRAYED);
pPopup->EnableMenuItem(ID__DELETEROW, MF_DISABLED | MF_GRAYED);
}
if(GetColumnCount() != cellRange.GetColSpan()+1){ // not a full row selected
pPopup->EnableMenuItem(ID__INSERTROW, MF_DISABLED | MF_GRAYED);
pPopup->EnableMenuItem(ID__DELETEROW, MF_DISABLED | MF_GRAYED);
}
pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, parent);
*/
}
/* Called when the user has edited one cell */
void CMeasGrid::OnEndEditCell(int nRow, int nCol, CString str){
CGridCtrl::OnEndEditCell(nRow, nCol, str);
// tell the parent that we've done editing one box
if(parent != nullptr)
parent->PostMessage(WM_END_EDIT, 0, 0);
return;
}