Hello,I have a perhaps stupid problem but I can't solve it: I have a TScrollBox with 'alTop' aligned panels inside; I put them in a specific order but now they are all messed up: how can I order them the way I want? thank you in advance
Quote from: superc on April 12, 2023, 02:17:15 pmHello,I have a perhaps stupid problem but I can't solve it: I have a TScrollBox with 'alTop' aligned panels inside; I put them in a specific order but now they are all messed up: how can I order them the way I want? thank you in advanceAt design time just drag drop each panel to its place. At runtime try something like this:Code: Pascal [Select][+][-]var I: Integer;begin for I := 0 to ScrollBox1.ControlCount - 1 do if (ScrollBox1.Controls[I] is TPanel) then (ScrollBox1.Controls[I] as TPanel).Align := alNone; for I := 0 to ScrollBox1.ControlCount - 1 do begin if (ScrollBox1.Controls[I] is TPanel) then begin (ScrollBox1.Controls[I] as TPanel).Align := alTop; (ScrollBox1.Controls[I] as TPanel).Top := (ScrollBox1.Controls[I] as TPanel).Tag*((ScrollBox1.Controls[I] as TPanel).Height + 1); end; end; end; See attached project for more details.
so to do a safe and precise sorting I have to assign a tag... right?