What Is The The DelphiVCL Sender Property?
By Muhammad Azizul Hakim December 22, 2021
The Sender property specifies which component notifies the change link object of changes.
We use Sender to access the component that has changed.
Here is a working example of the implementation of Sender property in DelphiVCL:
Using the Sender property allows us to create better abstractions in our code so that we do not refer to a specific component directly.
See the much longer complete code Для просмотра ссылки Войдиили Зарегистрируйся.
By Muhammad Azizul Hakim December 22, 2021
The Sender property specifies which component notifies the change link object of changes.
We use Sender to access the component that has changed.
Here is a working example of the implementation of Sender property in DelphiVCL:
Python:
# Implementation in Color Box Creation
def ColorChangeHandler(Sender):
shpRectangle.Brush.Color = clbSelect.Selected
# Implementation in Draw Grid Creation
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 = grdTestSelectCell
See the much longer complete code Для просмотра ссылки Войди