How to use the State Property
By Muhammad Azizul Hakim June 23, 2021
State property is used as an indicator for which items are selected or checked.
For example, for each member of the Items array, we use State to determine whether the checkbox is selected (cbChecked), cleared (cbUnchecked), or dimmed (cbGrayed).
Note: cbGrayed corresponds to the indeterminate state.
State combines the information provided by the Boolean Checked property and the Boolean ItemEnabled property:
Here is the working example of the implementation of State in Draw Grid creation:
See the complete code Для просмотра ссылки Войди или Зарегистрируйся.
The result:


By Muhammad Azizul Hakim June 23, 2021
State property is used as an indicator for which items are selected or checked.
For example, for each member of the Items array, we use State to determine whether the checkbox is selected (cbChecked), cleared (cbUnchecked), or dimmed (cbGrayed).
Note: cbGrayed corresponds to the indeterminate state.
State combines the information provided by the Boolean Checked property and the Boolean ItemEnabled property:
- When Checked is True, State is cbChecked. However, when Checked is False, State may be either cbUnchecked or cbGrayed.
- When State is cbGrayed, ItemEnabled is False. However, ItemEnabled may also be False when State is cbUnchecked or cbChecked.)
Here is the working example of the implementation of State in Draw Grid creation:
Python:
def grdTestDrawCell(Sender, Col, Row, Rect, State):
if gdSelected in State:
Sender.Canvas.Brush.Color = clBlue # 0x00ff0000 # blue
Sender.Canvas.TextRect(Rect, Rect.Left+2, Rect.Top+2, "%d @ %d" % (Col, Row))
def grdTestSelectCell(Sender, Col, Row, CanSelect):
if Col == 2 and Row == 2:
CanSelect.Value = False
grdTest.OnDrawCell = grdTestDrawCell
grdTest.OnSelectCell = grdTestSelectCel
The result:

