Objective Grid: Making changes to read-only cells

Article ID: 515
Last updated: 16 Apr, 2018
Article ID: 515
Last updated: 16 Apr, 2018
Revision: 3
Views: 1801
Posted: 09 Jan, 2001
by Meltreger B.
Updated: 16 Apr, 2018
by Meltreger B.

Problem


How can I programmatically change cells that have been marked read-only?


Cause



Action


The only way to modify a read-only cell is to cause the grid to temporarily ignore the read-only status of all cells by calling SetLockReadOnly(FALSE).  Once this is done,  you may then change the cell's value or style attributes. After the changes are done, call SetLockReadOnly(TRUE) to cause the grid to respect the read-only status again.

Example:
 

// Tell the grid to temporarily ignore the read-only
// status of all cells
SetLockReadOnly(FALSE);

// Now change the value of the cell
SetValueRange(CGXRange(1, 1),
     CGXStyle().SetValue(_T('Foo')));

// Last, tell the grid to respect the read-only
// status of all cells again
SetLockReadOnly(FALSE);

See also:

Is there an exception-safe way to change read-only cells?

This article was:   Helpful | Not helpful
Report an issue
Article ID: 515
Last updated: 16 Apr, 2018
Revision: 3
Views: 1801
Posted: 09 Jan, 2001 by Meltreger B.
Updated: 16 Apr, 2018 by Meltreger B.

Others in this category