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;
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;
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 .. :)
ReplyDeleteCristian Peța That did it!! thanks Cristian.
Thanks all!
A bit similar to this question on SO: stackoverflow.com - Delphi: How to programmatically adjust visual ordering of components with align = alTop
ReplyDeleteFirst setting to TAlignLayout.Right and then to TAlignLayout.Left should also work.
ReplyDelete