CanSelect parameter is included inside the OnSelectCell event handler, while OnSelectCell occurs before a cell in the grid is selected.
Write an OnSelectCell event handler to specify whether any particular cell in the grid can be selected. The Col and Row parameters indicate the column and row indexes of the cell that is about to be selected.
Set the CanSelect parameter to False to prevent the cell being selected.
Here is the working example of the implementation of a CanSelect parameter:
1 2 3 4 5 6 7 8 9 |
grdTest = DrawGrid(pgTwo) grdTest.Parent = pgTwo grdTest.SetBounds(20, 220, 520, 180) def grdTestSelectCell(Sender, Col, Row, CanSelect): if Col == 2 and Row == 2: CanSelect.Value = False grdTest.OnSelectCell = grdTestSelectCell |
See the complete code here.
The result:
Check out DelphiVCL which easily allows you to build GUIs for Windows using Python.