try fix autosize in TToolBar

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1184 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
alexs75
2010-03-22 19:48:23 +00:00
parent 98dcd62339
commit 76a44434e5
2 changed files with 58 additions and 42 deletions

View File

@ -158,6 +158,7 @@
<link id="TRxDBGrid">RxDBGrid</link>-а.</p>
</descr>
</element>
@ -556,6 +557,7 @@
<link id="TRxDBGrid">RxDBGrid</link>-а.</p>
</descr>
<seealso>
@ -1104,6 +1106,7 @@ TRxDBCalcEdit является наследником TDBCalcEdit и имеет
<b>Count</b>
@ -1115,7 +1118,9 @@ TRxDBCalcEdit является наследником TDBCalcEdit и имеет
</element>
<element name="TFolderLister.Count">
<short>Количество прочитанных файлов/каталогов</short>
<descr>Свойство содержит в себе кол-во прочитанных файлов</descr>
<descr>
<p>Свойство содержит в себе кол-во прочитанных файлов</p>
</descr>
<seealso>
<link id="TFolderLister.Files"/>
</seealso>
@ -1125,34 +1130,8 @@ TRxDBCalcEdit является наследником TDBCalcEdit и имеет
<short>Свойство FileFolder</short>
<descr>
<b>property FileFolder:string</b>
Свойство FileFolder определяет каталог с файлами, который будет сканироваться при вызове метода
<b>Execute</b> и по содержимому которого будет произведено заполнение массива Files</descr>
<p>Свойство FileFolder определяет каталог с файлами, который будет сканироваться при вызове метода <link id="TFolderLister.Execute">Execute</link> и по содержимому которого будет произведено заполнение массива Files</p>
</descr>
<seealso>
<link id="TFolderLister.Execute"/>
</seealso>
@ -1161,13 +1140,17 @@ TRxDBCalcEdit является наследником TDBCalcEdit и имеет
<short>Свойство OnExecuteItem</short>
<descr>
<b>property OnExecuteItem:TNotifyEvent</b>
Свойство OnExecuteItem вызывается при выборе пункта меню, которые было сформировано по элементам массива Files</descr>
<p>Свойство OnExecuteItem вызывается при выборе пункта меню, которые было сформировано по элементам массива <link id="TFolderLister.Files">Files</link>
</p>
</descr>
</element>
<element name="TFolderLister.MenuItem">
<short>Свойство MenuItem</short>
<descr>
<b>property MenuItem:TMenuItem;</b>
Данное свойство определяет место в меню, где будет добавлено в виде подменю содержимое каталога FileFolder</descr>
<p>Данное свойство определяет место в меню, где будет добавлено в виде подменю содержимое каталога <link id="TFolderLister.FileFolder">FileFolder</link>
</p>
</descr>
<seealso>
<link id="TFolderLister.Execute"/>
</seealso>
@ -2398,6 +2381,7 @@ Description
<b>const</b> SearchDomain, FileName:
@ -2415,6 +2399,7 @@ Description
<b>String</b>;
@ -2432,6 +2417,7 @@ Description
<b>out</b> UserName, DomainName:
@ -2449,6 +2435,7 @@ Description
<b>String</b>);
</p>
<p>Процедура возвращает имя и домен пользователя операционной системы владельца указанного файла. </p>
@ -2483,6 +2470,7 @@ Description
<b>const</b> DirName:
@ -2494,6 +2482,7 @@ Description
<b>string</b>):
@ -2505,6 +2494,7 @@ Description
<b>string</b>;</p>
<p>Функция проверяет все разделители каталогов в указанном имени файла/каталога и, если нужно, меняет их на значение константы<b>DirectorySeparator</b>.</p>
</descr>
@ -2530,6 +2520,7 @@ Description
<b>string</b>;</p>
<p>Функция <b>GetUserName</b> возвращает имя оператора, залогиненго в системе</p>
</descr>

View File

@ -665,12 +665,25 @@ begin
FAutoSize:=AValue;
if csLoading in ComponentState then exit;
UpdateSize;
Invalidate;
//Invalidate;
end;
procedure TToolbarButton.UpdateSize;
var
AWidth:integer;
begin
SetBounds(Left, Top, Width, Height);
if csLoading in TToolbarItems(FOwnerItem.Collection).FToolPanel.ComponentState then exit;
if Assigned(TToolbarItems(FOwnerItem.Collection).FToolPanel.FImageList) then
begin
AWidth:=TToolbarItems(FOwnerItem.Collection).FToolPanel.FImageList.Width + 8;
if ShowCaption then
AWidth:= AWidth + Canvas.TextWidth(Caption) + Spacing;
end
else
AWidth:=Canvas.TextWidth(Caption);
SetBounds(Left, Top, AWidth, Height);
Invalidate;
end;
@ -857,6 +870,8 @@ begin
if FDefButtonHeight<>AValue then
begin
FDefButtonHeight:=AValue;
if csLoading in ComponentState then exit;
for i:=0 to FToolbarItems.Count - 1 do
FToolbarItems[i].FButton.UpdateSize;
end;
@ -869,6 +884,8 @@ begin
if FDefButtonWidth<>AValue then
begin
FDefButtonWidth:=AValue;
if csLoading in ComponentState then exit;
for i:=0 to FToolbarItems.Count - 1 do
FToolbarItems[i].FButton.UpdateSize;
end;
@ -1118,6 +1135,7 @@ end;
procedure TToolPanel.Loaded;
var
i, L:integer;
B:TToolbarItem;
begin
{ if csDesigning in ComponentState then
begin
@ -1127,8 +1145,10 @@ begin
inherited Loaded;
for i:=0 to FToolbarItems.Count - 1 do
begin
FToolbarItems[i].UpdateLeftAfterLoad;
FToolbarItems[i].FButton.Align:=BtnAl2Align[FButtonAllign];
B:=FToolbarItems[i];
B.UpdateLeftAfterLoad;
B.FButton.Align:=BtnAl2Align[FButtonAllign];
// B.FButton.UpdateSize;
end;
ReAlignToolBtn;
end;
@ -1176,10 +1196,13 @@ end;
procedure TToolPanel.SetBounds(aLeft, aTop, aWidth, aHeight: integer);
begin
if Assigned(FImageList) then
aHeight:=FImageList.Height+8 + BorderWidth * 2
else
aHeight:=FDefButtonHeight + BorderWidth * 2;
if not (csLoading in ComponentState) then
begin
if Assigned(FImageList) then
aHeight:=FImageList.Height+8 + BorderWidth * 2
else
aHeight:=FDefButtonHeight + BorderWidth * 2;
end;
inherited SetBounds(aLeft, aTop, aWidth, aHeight);
end;
@ -1192,6 +1215,7 @@ begin
{ if Assigned(FButton.Action) then
FButton.Action.UnRegisterChanges(FActionLink);}
FButton.Action:=AValue;
if csLoading in TToolbarItems(Collection).FToolPanel.ComponentState then exit;
FButton.UpdateSize;
{ if Assigned(AValue) then
AValue.RegisterChanges(FActionLink);}
@ -1254,8 +1278,9 @@ begin
if FButton.ShowCaption<>AValue then
begin
FButton.ShowCaption:=AValue;
FButton.UpdateSize;
FButton.Invalidate;
if not (csLoading in TToolbarItems(Collection).FToolPanel.ComponentState) then
FButton.UpdateSize;
// FButton.Invalidate;
end;
end;
@ -1388,7 +1413,7 @@ begin
FButton.Flat:=tpFlatBtns in TToolbarItems(ACollection).FToolPanel.Options;
FButton.Transparent:=tpTransparentBtns in TToolbarItems(ACollection).FToolPanel.Options;
FButton.ShowCaption:=false;
FButton.FAutoSize:=true;
FButton.FAutoSize:=false;
FButton.FOwnerItem:=Self;
FButton.FFullPush:=true;
// if not (csLoading in TToolbarItems(ACollection).FToolPanel.ComponentState) then