RAD Studio How To Use The CanSelect Parameter

FireWind

Свой
Регистрация
2 Дек 2005
Сообщения
1,957
Реакции
1,199
Credits
4,009
How To Use The CanSelect Parameter
By Muhammad Azizul Hakim April 3, 2021

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:
Python:
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 Для просмотра ссылки Войди или Зарегистрируйся.

The result:
1617617105364.png
1617617113167.png
Для просмотра ссылки Войди или Зарегистрируйся