From cae5e5fac1c65ce214531f0ff312f0ebd5c1a056 Mon Sep 17 00:00:00 2001 From: alexs75 Date: Wed, 31 Mar 2010 16:14:25 +0000 Subject: [PATCH] fix loading TToolBar.ImageList git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1193 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- components/rx/rxtoolbar.pas | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/components/rx/rxtoolbar.pas b/components/rx/rxtoolbar.pas index b17775617..7ce6d89d6 100644 --- a/components/rx/rxtoolbar.pas +++ b/components/rx/rxtoolbar.pas @@ -913,6 +913,8 @@ begin FImageList:=AValue; for i:=0 to FToolbarItems.Count - 1 do FToolbarItems[i].FButton.FImageList:=AValue; + + ReAlignToolBtn; end; procedure TToolPanel.SetImageListSelected(const AValue: TImageList); @@ -1037,16 +1039,11 @@ procedure TToolPanel.ReAlignToolBtn; var i, L:integer; begin -{ for i:=0 to FToolbarItems.Count - 1 do - begin - FToolbarItems[i].FButton.Align:=alNone; - end; - } L:=BorderWidth; for i:=0 to FToolbarItems.Count - 1 do begin FToolbarItems[i].FButton.Left:=L; -// FToolbarItems[i].FButton.Align:=BtnAl2Align[FButtonAllign]; + FToolbarItems[i].FButton.UpdateSize; L:=L + FToolbarItems[i].FButton.Width; end; end; @@ -1128,10 +1125,10 @@ procedure TToolPanel.RequestAlign; i, L:integer;} begin inherited RequestAlign; -{ if (Parent = nil) or (csDestroying in ComponentState) or (csLoading in ComponentState) or (not Parent.HandleAllocated) then + if (Parent = nil) or (csDestroying in ComponentState) or (csLoading in ComponentState) {or (not Parent.HandleAllocated) }then exit; // if not Parent.HandleAllocated then exit; - ReAlignToolBtn;} +// ReAlignToolBtn;} end; procedure TToolPanel.Loaded; @@ -1150,9 +1147,8 @@ begin B:=FToolbarItems[i]; B.UpdateLeftAfterLoad; B.FButton.Align:=BtnAl2Align[FButtonAllign]; - // B.FButton.UpdateSize; end; - ReAlignToolBtn; + //ReAlignToolBtn; end; constructor TToolPanel.Create(AOwner: TComponent); @@ -1161,7 +1157,8 @@ begin FArrowBmp:=CreateArrowBitmap; AutoSize:=false; FToolbarItems:=TToolbarItems.Create(Self); - Align:=alTop; + if Assigned(AOwner) and not (csLoading in AOwner.ComponentState) then + Align:=alTop; Height:=DefButtonHeight; FPropertyStorageLink:=TPropertyStorageLink.Create; FPropertyStorageLink.OnSave:=@OnIniSave;