What’s New in Step 2
Field + Property FColor: TColor; property Color: TColor read FColor write SetColor default clRed; The field stores the actual data.
The property exposes it to the Object Inspector.
default clRed tells Lazarus the starting value.
Setter Method
procedure SetColor(AValue: TColor); Updates the field and calls Invalidate so the control repaints.
published Section
Any property declared here shows up in Lazarus’s Object Inspector.
Teaching tip: With this, a newbie can drop the control on a form, change its Color in the Object Inspector, and see the effect immediately.