From 76a44434e5f2cfe2f1fe67dbe1c03462c6ae5933 Mon Sep 17 00:00:00 2001 From: alexs75 Date: Mon, 22 Mar 2010 19:48:23 +0000 Subject: [PATCH] try fix autosize in TToolBar git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1184 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- components/rx/docs/rxfpc.xml | 53 +++++++++++++++--------------------- components/rx/rxtoolbar.pas | 47 ++++++++++++++++++++++++-------- 2 files changed, 58 insertions(+), 42 deletions(-) diff --git a/components/rx/docs/rxfpc.xml b/components/rx/docs/rxfpc.xml index 0741c59fa..40af5d4d4 100644 --- a/components/rx/docs/rxfpc.xml +++ b/components/rx/docs/rxfpc.xml @@ -158,6 +158,7 @@ + RxDBGrid-а.

@@ -556,6 +557,7 @@ + RxDBGrid-а.

@@ -1104,6 +1106,7 @@ TRxDBCalcEdit является наследником TDBCalcEdit и имеет + Count @@ -1115,7 +1118,9 @@ TRxDBCalcEdit является наследником TDBCalcEdit и имеет Количество прочитанных файлов/каталогов - Свойство содержит в себе кол-во прочитанных файлов + +

Свойство содержит в себе кол-во прочитанных файлов

+
@@ -1125,34 +1130,8 @@ TRxDBCalcEdit является наследником TDBCalcEdit и имеет Свойство FileFolder property FileFolder:string -Свойство FileFolder определяет каталог с файлами, который будет сканироваться при вызове метода - - - - - - - - - - - - - - - - - - - - - - - - - - - Execute и по содержимому которого будет произведено заполнение массива Files +

Свойство FileFolder определяет каталог с файлами, который будет сканироваться при вызове метода Execute и по содержимому которого будет произведено заполнение массива Files

+ @@ -1161,13 +1140,17 @@ TRxDBCalcEdit является наследником TDBCalcEdit и имеет Свойство OnExecuteItem property OnExecuteItem:TNotifyEvent -Свойство OnExecuteItem вызывается при выборе пункта меню, которые было сформировано по элементам массива Files +

Свойство OnExecuteItem вызывается при выборе пункта меню, которые было сформировано по элементам массива Files +

+
Свойство MenuItem property MenuItem:TMenuItem; -Данное свойство определяет место в меню, где будет добавлено в виде подменю содержимое каталога FileFolder +

Данное свойство определяет место в меню, где будет добавлено в виде подменю содержимое каталога FileFolder +

+ @@ -2398,6 +2381,7 @@ Description + const SearchDomain, FileName: @@ -2415,6 +2399,7 @@ Description + String; @@ -2432,6 +2417,7 @@ Description + out UserName, DomainName: @@ -2449,6 +2435,7 @@ Description + String);

Процедура возвращает имя и домен пользователя операционной системы владельца указанного файла.

@@ -2483,6 +2470,7 @@ Description + const DirName: @@ -2494,6 +2482,7 @@ Description + string): @@ -2505,6 +2494,7 @@ Description + string;

Функция проверяет все разделители каталогов в указанном имени файла/каталога и, если нужно, меняет их на значение константыDirectorySeparator.

@@ -2530,6 +2520,7 @@ Description + string;

Функция GetUserName возвращает имя оператора, залогиненго в системе

diff --git a/components/rx/rxtoolbar.pas b/components/rx/rxtoolbar.pas index 7c2240458..ea81d8c1b 100644 --- a/components/rx/rxtoolbar.pas +++ b/components/rx/rxtoolbar.pas @@ -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