Why is my buttons not created in logical order? If I run this, my buttons area created ACB rather than ABC as I expected.

Why is my buttons not created in logical order? If I run this, my buttons area created ACB rather than ABC as I expected.

procedure TForm1.FormCreate(Sender: TObject);
var
tbar: TToolbar;
cbtn: TCornerButton;
I: integer;
begin
tbar := TToolbar.Create(Form1);
tbar.Parent := Form1;

for I := 0 to 2 do
begin
cbtn := TCornerButton.Create(tbarGrid);
cbtn.Parent := tbarGrid;
cbtn.Align := TAlignLayout.Left;
cbtn.Text := Chr(65 + I);
end;
end;

Comments

  1. Gerhard Venter Thanks for noticing. I actually copied the code from my project to just show the issue. That did not solve it, but thanks for noticing .. :)
    Cristian Peța That did it!! thanks Cristian.

    Thanks all!

    ReplyDelete
  2. First setting to TAlignLayout.Right and then to TAlignLayout.Left should also work.

    ReplyDelete

Post a Comment