From c9747bd13cd38331ed80d776816668c4d0c7d325 Mon Sep 17 00:00:00 2001 From: paul Date: Thu, 25 Dec 2008 03:52:21 +0000 Subject: [PATCH] lcl: some formatting git-svn-id: trunk@17946 - --- lcl/include/radiogroup.inc | 43 +++++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/lcl/include/radiogroup.inc b/lcl/include/radiogroup.inc index 22beb98058..c4e919fda5 100644 --- a/lcl/include/radiogroup.inc +++ b/lcl/include/radiogroup.inc @@ -34,7 +34,7 @@ begin inherited Create (TheOwner); ControlStyle := ControlStyle + [csCaptureMouse, csClickEvents, csSetCaption, csDoubleClicks]; - FItems := TStringList.Create; + FItems := TStringList.Create; FAutoFill := true; //TStringList(FItems).OnChanging := @ItemsChanged; TStringList(FItems).OnChange := @ItemsChanged; @@ -138,16 +138,19 @@ begin FUpdatingItems:=true; try // destroy radiobuttons, if there are too many - while FButtonList.Count>FItems.Count do begin + while FButtonList.Count>FItems.Count do + begin TRadioButton(FButtonList[FButtonList.Count-1]).Free; FButtonList.Delete(FButtonList.Count-1); end; // create as many TRadioButton as needed - while (FButtonList.Count=FItems.Count) then FItemIndex:=FItems.Count-1; - if FItems.Count>0 then begin + if FItems.Count>0 then + begin // to reduce overhead do it in several steps // assign Caption and then Parent - for i:=0 to FItems.Count-1 do begin + for i:=0 to FItems.Count-1 do + begin ARadioButton := TRadioButton(FButtonList[i]); ARadioButton.Caption := FItems[i]; - ARadioButton.Parent:=Self; + ARadioButton.Parent := Self; end; - with FHiddenButton do begin + with FHiddenButton do + begin FHiddenButton.Visible:=false; Parent:=Self; if HandleAllocated then @@ -190,12 +197,13 @@ begin end; // the checked and unchecked states can be applied only after all other - for i:=0 to FItems.Count-1 do begin + for i := 0 to FItems.Count-1 do + begin ARadioButton := TRadioButton(FButtonList[i]); ARadioButton.Checked := (i = FItemIndex); ARadioButton.Visible := true; end; - FHiddenButton.Checked:=(fItemIndex=-1); + FHiddenButton.Checked := (FItemIndex = -1); UpdateTabStops; end; finally @@ -455,12 +463,13 @@ var i: Integer; RadioBtn: TRadioButton; begin - for i := 0 to FButtonList.Count-1 do begin + for i := 0 to FButtonList.Count - 1 do + begin RadioBtn := TRadioButton(FButtonList[i]); RadioBtn.TabStop := RadioBtn.Checked; end; if (FItemIndex=-1) and (Items.Count>0) then - TRadioButton(FButtonList[0]).TabStop := true; + TRadioButton(FButtonList[0]).TabStop := True; end; procedure TCustomRadioGroup.SetAutoFill(const AValue: Boolean);