Reputation: 40145
I declare a panel ToolStatusPanel2
at design time and want to add 10 panels which represent a status, shown by the colour.
Now, my main form declares
ToolOnlineStatusPanel : Array[0..Pred(NUM_TOOLS)] of TPanel;
and my FormCreate
wants to set them to default color to clRed
by
for i:= 0 to Pred(NUM_TOOLS) do
begin
ToolOnlineStatusPanel[i] := TPanel.Create(ToolStatusPanel2);
ToolOnlineStatusPanel[i].Parent := ToolStatusPanel2;
ToolOnlineStatusPanel[i].Height := 16;
ToolOnlineStatusPanel[i].Width := 16;
ToolOnlineStatusPanel[i].Top := 8 + (i * (16 + 8));
ToolOnlineStatusPanel[i].Left := 8;
ToolOnlineStatusPanel[i].Color := clRed;
end;
but these child panels always have the same colo(u)r as their parent, even if I change that - never red.
Obviously I am overlooking something fairly simple. What is it? Thanks
Upvotes: 1
Views: 147