Procedure SetChildTaborders(const Parent: TWinControl) ;
procedure FixTabOrder(const Parent: TWinControl) ;
var
ctl, L: Integer;
List: TList;
begin
List := TList.Create;
try
for ctl := 0 to Parent.ControlCount - 1 do
begin
if Parent.Controls[ctl] is TWinControl then
begin
if List.Count = 0 then
L := 0
else
begin
with Parent.Controls[ctl] do
for L := 0 to List.Count - 1 do
if (Top < TControl(List[L]).Top) or
((Top = TControl(List[L]).Top) and (Left < TControl(List[L]).Left)) then
Break;
end;
List.Insert(L, Parent.Controls[ctl]) ;
FixTabOrder(TWinControl(Parent.Controls[ctl])) ;
end;
end;
for ctl := 0 to List.Count - 1 do
TWinControl(List[ctl]).TabOrder := ctl;
finally
List.Free;
end;
end;
begin
FixTabOrder(Parent) ;
end;
沒有留言:
張貼留言