| | | | Browse by category |
Problem
How can I adjust and validate cells when I paste data from the clipboard? OnValidateCell() is not called.
Cause
Action
OnValidateCell will not be called when you paste text into cells, because the OnValidateCell() is only fired when you leave the current cell.
When you paste data into a range of cells, the method CGXControl::StoreStyle() will be called for each affected cell. CGXControl::StoreStyle() will call CGXGridCore::StoreStyleRowCol(). So, you can override any of these two methods to validate the pasted data.
When you paste data in CF_TEXT format into the grid, CGXControl::SetControlText() will be called for every cell. So, when you implement your own controls, you can override this method to validate and adjust the input before it is stored in the cell.
When data are copied to clipboard in CF_TEXT format, CGXControl::GetControlText() will be called to determine the text to be copied to the clipboard for each cell.