CanEditColumn - cCJGrid
Called before entering Edit mode. Returns True if the SelectedRow and column can be edited
Type: Function
Return Data Type: Boolean
Parameters
| Parameter | Type | Description |
|---|---|---|
| iCol | Integer | The column about to be edited |
Syntax
Function CanEditColumn Integer iCol Returns Boolean
Call Example
Get CanEditColumn iCol to BooleanVariable
Description
The CanEditColumn function is called before entering edit mode. If the function returns False, the edit will be cancelled. The row to be edited will always be the SelectedRow. The column number, which is passed, will be the SelectedColumn unless pbFocusSubItems is false, in which case it will be the column that was clicked or double-clicked.
This function is only called if cell is editable (pbAllowEdit is true and cCJGridColumn's pbEditable is true), so the default behavior of this function is to return False if pbReadOnly is True.
This function can be used create editing rules that can be applied to the cell level.
This example shows how editing of one cell in a row is not allowed based on the value of a different cell in the same row. Cell editing is disabled for the oSize column if the oType grid column is "datetime".
Function CanEditColumn Integer iCol Returns Boolean
String sValue
Boolean bCanDo
Integer iRow iSizeCol
Handle hoDataSource
Forward Get CanEditColumn iCol to bCanDo
If (bCanDo) Begin
Get piColumnId of oSize to iSizeCol
If (iCol=iSizeCol) Begin
Get SelectedRowValue of oType to sValue
If (sValue="datetime") Begin
Move False to bCanDo
End
End
End
Function_Return bCanDo
End_Function
User interface actions, such as message boxes, may not be used in this function.
See Also
CanAddRow | CanSaveRow | CanDeleteRow
Return Value
Returns True if the SelectedRow and column can be edited. If the function returns False, the edit will be cancelled.