fix loading TToolBar.ImageList

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1193 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
alexs75 2010-03-31 16:14:25 +00:00
parent 5fa7dd2067
commit cae5e5fac1

View File

@ -913,6 +913,8 @@ begin
FImageList:=AValue; FImageList:=AValue;
for i:=0 to FToolbarItems.Count - 1 do for i:=0 to FToolbarItems.Count - 1 do
FToolbarItems[i].FButton.FImageList:=AValue; FToolbarItems[i].FButton.FImageList:=AValue;
ReAlignToolBtn;
end; end;
procedure TToolPanel.SetImageListSelected(const AValue: TImageList); procedure TToolPanel.SetImageListSelected(const AValue: TImageList);
@ -1037,16 +1039,11 @@ procedure TToolPanel.ReAlignToolBtn;
var var
i, L:integer; i, L:integer;
begin begin
{ for i:=0 to FToolbarItems.Count - 1 do
begin
FToolbarItems[i].FButton.Align:=alNone;
end;
}
L:=BorderWidth; L:=BorderWidth;
for i:=0 to FToolbarItems.Count - 1 do for i:=0 to FToolbarItems.Count - 1 do
begin begin
FToolbarItems[i].FButton.Left:=L; FToolbarItems[i].FButton.Left:=L;
// FToolbarItems[i].FButton.Align:=BtnAl2Align[FButtonAllign]; FToolbarItems[i].FButton.UpdateSize;
L:=L + FToolbarItems[i].FButton.Width; L:=L + FToolbarItems[i].FButton.Width;
end; end;
end; end;
@ -1128,10 +1125,10 @@ procedure TToolPanel.RequestAlign;
i, L:integer;} i, L:integer;}
begin begin
inherited RequestAlign; 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; exit;
// if not Parent.HandleAllocated then exit; // if not Parent.HandleAllocated then exit;
ReAlignToolBtn;} // ReAlignToolBtn;}
end; end;
procedure TToolPanel.Loaded; procedure TToolPanel.Loaded;
@ -1150,9 +1147,8 @@ begin
B:=FToolbarItems[i]; B:=FToolbarItems[i];
B.UpdateLeftAfterLoad; B.UpdateLeftAfterLoad;
B.FButton.Align:=BtnAl2Align[FButtonAllign]; B.FButton.Align:=BtnAl2Align[FButtonAllign];
// B.FButton.UpdateSize;
end; end;
ReAlignToolBtn; //ReAlignToolBtn;
end; end;
constructor TToolPanel.Create(AOwner: TComponent); constructor TToolPanel.Create(AOwner: TComponent);
@ -1161,6 +1157,7 @@ begin
FArrowBmp:=CreateArrowBitmap; FArrowBmp:=CreateArrowBitmap;
AutoSize:=false; AutoSize:=false;
FToolbarItems:=TToolbarItems.Create(Self); FToolbarItems:=TToolbarItems.Create(Self);
if Assigned(AOwner) and not (csLoading in AOwner.ComponentState) then
Align:=alTop; Align:=alTop;
Height:=DefButtonHeight; Height:=DefButtonHeight;
FPropertyStorageLink:=TPropertyStorageLink.Create; FPropertyStorageLink:=TPropertyStorageLink.Create;