| | | | Browse by category |
Article ID: 554
Last updated: 16 Apr, 2018
Problem
Can I outline cells depending on their value?
Cause
Action
The following example changes only the SetInterior( ) style of a cell, which can be one of
- gray: value not used (cell will be made read-only, another change)
- white: value is not yet set
- green: value is set, interacting values result in feasible set
- red: value is set, interacting values result in infeasible set
All other properties of the cell remain unchanged.
BOOL CSampleView::GetStyleRowCol(ROWCOL nRow, ROWCOL nCol, CGXStyle& style, GXModifyType mt, int nType) { |
||||
CMyGridView::GetStyleRowCol(nRow, nCol, style, mt, nType); if (nRow > 0 && nCol > 0) { |
||||
CString s = style.GetValueRef( ); if (criteria_1) { |
||||
// disable the cell - user can't click into it anymore style.SetEnabled(FALSE).SetInterior(RGB(192,192,192)); |
||||
} else if (s.IsEmpty( )) { |
||||
// make white if empty style.SetInterior(RGB(255,255,255)); |
||||
} else if (invalid s) { |
||||
// make red if invalid syle.SezInterior(RGB(255,0,0)); |
||||
} else { |
||||
// make green if valid style.SetInterior(RGB(0,255,0)); |
||||
} | ||||
} return TRUE; |
||||
} |
This would also be a good example for using base styles. See "What is a base style"
This article was:
Helpful |
Not helpful
Report an issue
Article ID: 554
Last updated: 16 Apr, 2018
Revision: 3
Views: 1712
Posted: 09 Jan, 2001 by
Meltreger B.
Updated: 16 Apr, 2018 by
Meltreger B.
Others in this category
Powered by KBPublisher (Knowledge base software)