| | | | Browse by category |
Article ID: 42
Last updated: 16 Apr, 2018
Problem
What is a User Attribute?
Cause
Action
User Attributes help you store information in cells that can be interpreted by custom cell types. Suppose you implement a new cell type, CMyEditControl, that underlines the text when the value in the cell is greater than a given number. The number can be different for individual cells.
This number is a good example for using user attributes. If you register a new user attribute with the ID IDS_UA_COMPARENUMBER, you can apply this user attribute to individual cells with SetStyleRange() and SetUserAttribute(). In CMyEditControl, you can read this attribute with GetUserAttribute().
Example:
- Apply number to individual cells
-
SetStyleRange(CGXRange(nRow, 1), CGXStyle() .SetControl(IDS_CTRL_MYEDIT)
.SetUserAttribute(IDS_UA_COMPARENUMBER, 100)); SetStyleRange(CGXRange(nRow, 2), CGXStyle() .SetControl(IDS_CTRL_MYEDIT)
.SetUserAttribute(IDS_UA_COMPARENUMBER, 200)); - In CMyEditControl you can read this user attribute:
-
// read number
double number = atof(m_pStyle->GetUserAttribute(IDS_UA_COMPARENUMBER));
This article was:
Helpful |
Not helpful
Report an issue
Article ID: 42
Last updated: 16 Apr, 2018
Revision: 4
Views: 1943
Posted: 24 Jan, 2001 by
Meltreger B.
Updated: 16 Apr, 2018 by
Meltreger B.
Others in this category
Powered by KBPublisher (Knowledge base software)