mirror of
				https://gitlab.com/freepascal.org/lazarus/lazarus.git
				synced 2025-10-31 16:21:45 +01:00 
			
		
		
		
	added DisableAutoSizing/EnableAutoSizing, fixed crash on adding a notebook page with autosized controls
git-svn-id: trunk@7675 -
This commit is contained in:
		
							parent
							
								
									19fb9dc230
								
							
						
					
					
						commit
						90c9bc8170
					
				| @ -40,7 +40,6 @@ Type | |||||||
| 
 | 
 | ||||||
|   TCustomElementEditor = Class(TPanel) |   TCustomElementEditor = Class(TPanel) | ||||||
|   private |   private | ||||||
|     FChangedEvent: TNotifyEvent; |  | ||||||
|     Felement : TDomElement; |     Felement : TDomElement; | ||||||
|     FGetElementList: TGetElementListEvent; |     FGetElementList: TGetElementListEvent; | ||||||
|     FSavedNode, |     FSavedNode, | ||||||
| @ -519,6 +518,7 @@ begin | |||||||
|   If Not Result then |   If Not Result then | ||||||
|     begin |     begin | ||||||
|     SS:=TStringStream.Create(Head+S+Tail); |     SS:=TStringStream.Create(Head+S+Tail); | ||||||
|  |     D:=nil; | ||||||
|     Try |     Try | ||||||
|       Try |       Try | ||||||
|         ReadXmlFile(D,SS); |         ReadXmlFile(D,SS); | ||||||
|  | |||||||
| @ -6,14 +6,13 @@ object MainForm: TMainForm | |||||||
|   OnCloseQuery = MainFormCloseQuery |   OnCloseQuery = MainFormCloseQuery | ||||||
|   OnCreate = MainFormCreate |   OnCreate = MainFormCreate | ||||||
|   OnDestroy = MainFormDestroy |   OnDestroy = MainFormDestroy | ||||||
|   PixelsPerInch = 75 |   PixelsPerInch = 112 | ||||||
|   HorzScrollBar.Page = 601 |   HorzScrollBar.Page = 601 | ||||||
|   VertScrollBar.Page = 517 |   VertScrollBar.Page = 517 | ||||||
|   Left = 189 |   Left = 189 | ||||||
|   Height = 544 |   Height = 544 | ||||||
|   Width = 602 |   Width = 602 | ||||||
|   object TBMain: TToolBar |   object TBMain: TToolBar | ||||||
|     BorderSpacing.OnChange = nil |  | ||||||
|     ButtonHeight = 28 |     ButtonHeight = 28 | ||||||
|     ButtonWidth = 28 |     ButtonWidth = 28 | ||||||
|     Caption = 'TBMain' |     Caption = 'TBMain' | ||||||
| @ -188,7 +187,6 @@ object MainForm: TMainForm | |||||||
|   end |   end | ||||||
|   object PCFiles: TPageControl |   object PCFiles: TPageControl | ||||||
|     Align = alClient |     Align = alClient | ||||||
|     BorderSpacing.OnChange = nil |  | ||||||
|     TabOrder = 1 |     TabOrder = 1 | ||||||
|     Left = 5 |     Left = 5 | ||||||
|     Height = 468 |     Height = 468 | ||||||
|  | |||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @ -821,8 +821,13 @@ begin | |||||||
| end; | end; | ||||||
| 
 | 
 | ||||||
| procedure TMainForm.ApplyOptions; | procedure TMainForm.ApplyOptions; | ||||||
|  | var | ||||||
|  |   i: Integer; | ||||||
| begin | begin | ||||||
|   ShowHint := ShowHelpHints; |   ShowHint := ShowHelpHints; | ||||||
|  |   for i:=0 to ComponentCount-1 do | ||||||
|  |     if Components[i] is TToolButton then | ||||||
|  |       TToolButton(Components[i]).ShowHint:=ShowHelpHints; | ||||||
| end; | end; | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -8,11 +8,11 @@ | |||||||
|         <SaveOnlyProjectUnits Value="True"/> |         <SaveOnlyProjectUnits Value="True"/> | ||||||
|       </Flags> |       </Flags> | ||||||
|       <MainUnit Value="0"/> |       <MainUnit Value="0"/> | ||||||
|       <ActiveEditorIndexAtStart Value="10"/> |  | ||||||
|       <AutoCreateForms Value="False"/> |       <AutoCreateForms Value="False"/> | ||||||
|       <IconPath Value="./"/> |       <IconPath Value="./"/> | ||||||
|       <TargetFileExt Value=".exe"/> |       <TargetFileExt Value=".exe"/> | ||||||
|       <Title Value="Lazarus Documentation Editor"/> |       <Title Value="Lazarus Documentation Editor"/> | ||||||
|  |       <ActiveEditorIndexAtStart Value="5"/> | ||||||
|     </General> |     </General> | ||||||
|     <Units Count="13"> |     <Units Count="13"> | ||||||
|       <Unit0> |       <Unit0> | ||||||
| @ -21,23 +21,23 @@ | |||||||
|         <IsPartOfProject Value="True"/> |         <IsPartOfProject Value="True"/> | ||||||
|         <TopLine Value="1"/> |         <TopLine Value="1"/> | ||||||
|         <UnitName Value="lazde"/> |         <UnitName Value="lazde"/> | ||||||
|         <UsageCount Value="97"/> |         <UsageCount Value="98"/> | ||||||
|       </Unit0> |       </Unit0> | ||||||
|       <Unit1> |       <Unit1> | ||||||
|         <CursorPos X="17" Y="21"/> |         <CursorPos X="15" Y="803"/> | ||||||
|         <EditorIndex Value="4"/> |         <EditorIndex Value="0"/> | ||||||
|         <Filename Value="frmmain.pp"/> |         <Filename Value="frmmain.pp"/> | ||||||
|         <ComponentName Value="MainForm"/> |         <ComponentName Value="MainForm"/> | ||||||
|         <IsPartOfProject Value="True"/> |         <IsPartOfProject Value="True"/> | ||||||
|         <Loaded Value="True"/> |         <Loaded Value="True"/> | ||||||
|         <ResourceFilename Value="frmmain.lrs"/> |         <ResourceFilename Value="frmmain.lrs"/> | ||||||
|         <TopLine Value="1"/> |         <TopLine Value="787"/> | ||||||
|         <UnitName Value="FrmMain"/> |         <UnitName Value="FrmMain"/> | ||||||
|         <UsageCount Value="97"/> |         <UsageCount Value="98"/> | ||||||
|       </Unit1> |       </Unit1> | ||||||
|       <Unit2> |       <Unit2> | ||||||
|         <CursorPos X="1" Y="23"/> |         <CursorPos X="1" Y="23"/> | ||||||
|         <EditorIndex Value="2"/> |         <EditorIndex Value="10"/> | ||||||
|         <Filename Value="frmoptions.pp"/> |         <Filename Value="frmoptions.pp"/> | ||||||
|         <ComponentName Value="OptionsForm"/> |         <ComponentName Value="OptionsForm"/> | ||||||
|         <IsPartOfProject Value="True"/> |         <IsPartOfProject Value="True"/> | ||||||
| @ -45,11 +45,11 @@ | |||||||
|         <ResourceFilename Value="frmoptions.lrs"/> |         <ResourceFilename Value="frmoptions.lrs"/> | ||||||
|         <TopLine Value="1"/> |         <TopLine Value="1"/> | ||||||
|         <UnitName Value="frmOptions"/> |         <UnitName Value="frmOptions"/> | ||||||
|         <UsageCount Value="94"/> |         <UsageCount Value="95"/> | ||||||
|       </Unit2> |       </Unit2> | ||||||
|       <Unit3> |       <Unit3> | ||||||
|         <CursorPos X="1" Y="23"/> |         <CursorPos X="1" Y="23"/> | ||||||
|         <EditorIndex Value="3"/> |         <EditorIndex Value="11"/> | ||||||
|         <Filename Value="frmnewnode.pp"/> |         <Filename Value="frmnewnode.pp"/> | ||||||
|         <ComponentName Value="NewNodeForm"/> |         <ComponentName Value="NewNodeForm"/> | ||||||
|         <IsPartOfProject Value="True"/> |         <IsPartOfProject Value="True"/> | ||||||
| @ -57,11 +57,11 @@ | |||||||
|         <ResourceFilename Value="frmnewnode.lrs"/> |         <ResourceFilename Value="frmnewnode.lrs"/> | ||||||
|         <TopLine Value="1"/> |         <TopLine Value="1"/> | ||||||
|         <UnitName Value="frmNewNode"/> |         <UnitName Value="frmNewNode"/> | ||||||
|         <UsageCount Value="91"/> |         <UsageCount Value="92"/> | ||||||
|       </Unit3> |       </Unit3> | ||||||
|       <Unit4> |       <Unit4> | ||||||
|         <CursorPos X="32" Y="27"/> |         <CursorPos X="32" Y="27"/> | ||||||
|         <EditorIndex Value="6"/> |         <EditorIndex Value="13"/> | ||||||
|         <Filename Value="frmmakeskel.pp"/> |         <Filename Value="frmmakeskel.pp"/> | ||||||
|         <ComponentName Value="MakeSkelForm"/> |         <ComponentName Value="MakeSkelForm"/> | ||||||
|         <IsPartOfProject Value="True"/> |         <IsPartOfProject Value="True"/> | ||||||
| @ -69,11 +69,11 @@ | |||||||
|         <ResourceFilename Value="frmmakeskel.lrs"/> |         <ResourceFilename Value="frmmakeskel.lrs"/> | ||||||
|         <TopLine Value="1"/> |         <TopLine Value="1"/> | ||||||
|         <UnitName Value="FrmMakeSkel"/> |         <UnitName Value="FrmMakeSkel"/> | ||||||
|         <UsageCount Value="68"/> |         <UsageCount Value="69"/> | ||||||
|       </Unit4> |       </Unit4> | ||||||
|       <Unit5> |       <Unit5> | ||||||
|         <CursorPos X="11" Y="16"/> |         <CursorPos X="11" Y="16"/> | ||||||
|         <EditorIndex Value="0"/> |         <EditorIndex Value="8"/> | ||||||
|         <Filename Value="frmlink.pp"/> |         <Filename Value="frmlink.pp"/> | ||||||
|         <ComponentName Value="LinkForm"/> |         <ComponentName Value="LinkForm"/> | ||||||
|         <IsPartOfProject Value="True"/> |         <IsPartOfProject Value="True"/> | ||||||
| @ -81,11 +81,11 @@ | |||||||
|         <ResourceFilename Value="frmlink.lrs"/> |         <ResourceFilename Value="frmlink.lrs"/> | ||||||
|         <TopLine Value="1"/> |         <TopLine Value="1"/> | ||||||
|         <UnitName Value="FrmLink"/> |         <UnitName Value="FrmLink"/> | ||||||
|         <UsageCount Value="61"/> |         <UsageCount Value="62"/> | ||||||
|       </Unit5> |       </Unit5> | ||||||
|       <Unit6> |       <Unit6> | ||||||
|         <CursorPos X="1" Y="23"/> |         <CursorPos X="1" Y="23"/> | ||||||
|         <EditorIndex Value="1"/> |         <EditorIndex Value="9"/> | ||||||
|         <Filename Value="frmtable.pp"/> |         <Filename Value="frmtable.pp"/> | ||||||
|         <ComponentName Value="TableForm"/> |         <ComponentName Value="TableForm"/> | ||||||
|         <IsPartOfProject Value="True"/> |         <IsPartOfProject Value="True"/> | ||||||
| @ -93,11 +93,11 @@ | |||||||
|         <ResourceFilename Value="frmtable.lrs"/> |         <ResourceFilename Value="frmtable.lrs"/> | ||||||
|         <TopLine Value="1"/> |         <TopLine Value="1"/> | ||||||
|         <UnitName Value="frmTable"/> |         <UnitName Value="frmTable"/> | ||||||
|         <UsageCount Value="61"/> |         <UsageCount Value="62"/> | ||||||
|       </Unit6> |       </Unit6> | ||||||
|       <Unit7> |       <Unit7> | ||||||
|         <CursorPos X="35" Y="26"/> |         <CursorPos X="35" Y="26"/> | ||||||
|         <EditorIndex Value="5"/> |         <EditorIndex Value="12"/> | ||||||
|         <Filename Value="frmabout.pp"/> |         <Filename Value="frmabout.pp"/> | ||||||
|         <ComponentName Value="AboutForm"/> |         <ComponentName Value="AboutForm"/> | ||||||
|         <IsPartOfProject Value="True"/> |         <IsPartOfProject Value="True"/> | ||||||
| @ -105,41 +105,37 @@ | |||||||
|         <ResourceFilename Value="frmabout.lrs"/> |         <ResourceFilename Value="frmabout.lrs"/> | ||||||
|         <TopLine Value="1"/> |         <TopLine Value="1"/> | ||||||
|         <UnitName Value="FrmAbout"/> |         <UnitName Value="FrmAbout"/> | ||||||
|         <UsageCount Value="52"/> |         <UsageCount Value="53"/> | ||||||
|       </Unit7> |       </Unit7> | ||||||
|       <Unit8> |       <Unit8> | ||||||
|         <CursorPos X="16" Y="26"/> |         <CursorPos X="22" Y="251"/> | ||||||
|         <EditorIndex Value="12"/> |  | ||||||
|         <Filename Value="pkeditor.pp"/> |         <Filename Value="pkeditor.pp"/> | ||||||
|         <IsPartOfProject Value="True"/> |         <IsPartOfProject Value="True"/> | ||||||
|         <Loaded Value="True"/> |         <TopLine Value="235"/> | ||||||
|         <TopLine Value="1"/> |  | ||||||
|         <UnitName Value="PkEditor"/> |         <UnitName Value="PkEditor"/> | ||||||
|         <UsageCount Value="46"/> |         <UsageCount Value="47"/> | ||||||
|       </Unit8> |       </Unit8> | ||||||
|       <Unit9> |       <Unit9> | ||||||
|         <CursorPos X="16" Y="497"/> |         <CursorPos X="12" Y="521"/> | ||||||
|         <EditorIndex Value="7"/> |         <EditorIndex Value="14"/> | ||||||
|         <Filename Value="eleditor.pp"/> |         <Filename Value="eleditor.pp"/> | ||||||
|         <IsPartOfProject Value="True"/> |         <IsPartOfProject Value="True"/> | ||||||
|         <Loaded Value="True"/> |         <Loaded Value="True"/> | ||||||
|         <TopLine Value="473"/> |         <TopLine Value="500"/> | ||||||
|         <UnitName Value="ElEditor"/> |         <UnitName Value="ElEditor"/> | ||||||
|         <UsageCount Value="46"/> |         <UsageCount Value="47"/> | ||||||
|       </Unit9> |       </Unit9> | ||||||
|       <Unit10> |       <Unit10> | ||||||
|         <CursorPos X="34" Y="28"/> |         <CursorPos X="34" Y="28"/> | ||||||
|         <EditorIndex Value="11"/> |  | ||||||
|         <Filename Value="fpdeutil.pp"/> |         <Filename Value="fpdeutil.pp"/> | ||||||
|         <IsPartOfProject Value="True"/> |         <IsPartOfProject Value="True"/> | ||||||
|         <Loaded Value="True"/> |  | ||||||
|         <TopLine Value="1"/> |         <TopLine Value="1"/> | ||||||
|         <UnitName Value="FPDEUtil"/> |         <UnitName Value="FPDEUtil"/> | ||||||
|         <UsageCount Value="46"/> |         <UsageCount Value="47"/> | ||||||
|       </Unit10> |       </Unit10> | ||||||
|       <Unit11> |       <Unit11> | ||||||
|         <CursorPos X="15" Y="71"/> |         <CursorPos X="15" Y="71"/> | ||||||
|         <EditorIndex Value="9"/> |         <EditorIndex Value="15"/> | ||||||
|         <Filename Value="frmexample.pp"/> |         <Filename Value="frmexample.pp"/> | ||||||
|         <ComponentName Value="ExampleForm"/> |         <ComponentName Value="ExampleForm"/> | ||||||
|         <IsPartOfProject Value="True"/> |         <IsPartOfProject Value="True"/> | ||||||
| @ -147,11 +143,11 @@ | |||||||
|         <ResourceFilename Value="frmexample.lrs"/> |         <ResourceFilename Value="frmexample.lrs"/> | ||||||
|         <TopLine Value="66"/> |         <TopLine Value="66"/> | ||||||
|         <UnitName Value="FrmExample"/> |         <UnitName Value="FrmExample"/> | ||||||
|         <UsageCount Value="37"/> |         <UsageCount Value="38"/> | ||||||
|       </Unit11> |       </Unit11> | ||||||
|       <Unit12> |       <Unit12> | ||||||
|         <CursorPos X="3" Y="570"/> |         <CursorPos X="19" Y="568"/> | ||||||
|         <EditorIndex Value="10"/> |         <EditorIndex Value="16"/> | ||||||
|         <Filename Value="frmbuild.pp"/> |         <Filename Value="frmbuild.pp"/> | ||||||
|         <ComponentName Value="BuildForm"/> |         <ComponentName Value="BuildForm"/> | ||||||
|         <IsPartOfProject Value="True"/> |         <IsPartOfProject Value="True"/> | ||||||
| @ -159,7 +155,7 @@ | |||||||
|         <ResourceFilename Value="frmbuild.lrs"/> |         <ResourceFilename Value="frmbuild.lrs"/> | ||||||
|         <TopLine Value="545"/> |         <TopLine Value="545"/> | ||||||
|         <UnitName Value="frmBuild"/> |         <UnitName Value="frmBuild"/> | ||||||
|         <UsageCount Value="32"/> |         <UsageCount Value="33"/> | ||||||
|       </Unit12> |       </Unit12> | ||||||
|     </Units> |     </Units> | ||||||
|     <PublishOptions> |     <PublishOptions> | ||||||
|  | |||||||
| @ -233,6 +233,7 @@ end; | |||||||
| 
 | 
 | ||||||
| procedure TEditorPage.ElementChanged(Sender: TObject); | procedure TEditorPage.ElementChanged(Sender: TObject); | ||||||
| begin | begin | ||||||
|  |   if Sender=nil then ; | ||||||
|   TPackageEditor(FPackages).UpdateSelectedNodeStatus; |   TPackageEditor(FPackages).UpdateSelectedNodeStatus; | ||||||
| end; | end; | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -255,8 +255,6 @@ end; | |||||||
|   ---------------------------------------------------------------------} |   ---------------------------------------------------------------------} | ||||||
| 
 | 
 | ||||||
| Constructor TPackageEditor.Create(AOwner : TComponent); | Constructor TPackageEditor.Create(AOwner : TComponent); | ||||||
| var |  | ||||||
|   TmpPanel: TPanel; |  | ||||||
| 
 | 
 | ||||||
|   Function NewMenuItem(ACaption : String; AOnClick : TNotifyEvent) : TMenuItem; |   Function NewMenuItem(ACaption : String; AOnClick : TNotifyEvent) : TMenuItem; | ||||||
| 
 | 
 | ||||||
| @ -521,6 +519,7 @@ procedure TPackageEditor.MenuCollapseAllClick(Sender: TObject); | |||||||
| var | var | ||||||
|   Node: TTreeNode; |   Node: TTreeNode; | ||||||
| begin | begin | ||||||
|  |   if Sender=nil then ; | ||||||
|   ElementTree.FullCollapse; |   ElementTree.FullCollapse; | ||||||
|   Node := ElementTree.Items.GetFirstNode; |   Node := ElementTree.Items.GetFirstNode; | ||||||
|   if Node<>nil then |   if Node<>nil then | ||||||
| @ -529,6 +528,7 @@ end; | |||||||
| 
 | 
 | ||||||
| procedure TPackageEditor.MenuExpandAllClick(Sender: TObject); | procedure TPackageEditor.MenuExpandAllClick(Sender: TObject); | ||||||
| begin | begin | ||||||
|  |   if Sender=nil then ; | ||||||
|   ElementTree.FullExpand; |   ElementTree.FullExpand; | ||||||
| end; | end; | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -719,6 +719,7 @@ type | |||||||
|     FAlign: TAlign; |     FAlign: TAlign; | ||||||
|     FAnchors: TAnchors; |     FAnchors: TAnchors; | ||||||
|     FAnchorSides: array[TAnchorKind] of TAnchorSide; |     FAnchorSides: array[TAnchorKind] of TAnchorSide; | ||||||
|  |     FAutoSizingLockCount: Integer; | ||||||
|     FAutoSize: Boolean; |     FAutoSize: Boolean; | ||||||
|     FBaseBounds: TRect; |     FBaseBounds: TRect; | ||||||
|     FBaseBoundsLock: integer; |     FBaseBoundsLock: integer; | ||||||
| @ -1065,6 +1066,8 @@ type | |||||||
|                                Raw: boolean); virtual; |                                Raw: boolean); virtual; | ||||||
|     procedure CNPreferredSizeChanged; |     procedure CNPreferredSizeChanged; | ||||||
|     procedure InvalidatePreferredSize; virtual; |     procedure InvalidatePreferredSize; virtual; | ||||||
|  |     procedure DisableAutoSizing; | ||||||
|  |     procedure EnableAutoSizing; | ||||||
|   public |   public | ||||||
|     constructor Create(TheOwner: TComponent);override; |     constructor Create(TheOwner: TComponent);override; | ||||||
|     destructor Destroy; override; |     destructor Destroy; override; | ||||||
| @ -1600,6 +1603,8 @@ type | |||||||
|     procedure InvalidateClientRectCache(WithChildControls: boolean); |     procedure InvalidateClientRectCache(WithChildControls: boolean); | ||||||
|     function ClientRectNeedsInterfaceUpdate: boolean; |     function ClientRectNeedsInterfaceUpdate: boolean; | ||||||
|     procedure SetBounds(aLeft, aTop, aWidth, aHeight: integer); override; |     procedure SetBounds(aLeft, aTop, aWidth, aHeight: integer); override; | ||||||
|  |     procedure DisableAlign; | ||||||
|  |     procedure EnableAlign; | ||||||
|   public |   public | ||||||
|     constructor Create(TheOwner: TComponent);override; |     constructor Create(TheOwner: TComponent);override; | ||||||
|     constructor CreateParented(ParentWindow: HWnd); |     constructor CreateParented(ParentWindow: HWnd); | ||||||
| @ -1617,8 +1622,6 @@ type | |||||||
|     Procedure BroadCast(var ToAllMessage); |     Procedure BroadCast(var ToAllMessage); | ||||||
|     procedure NotifyControls(Msg: Word); |     procedure NotifyControls(Msg: Word); | ||||||
|     procedure DefaultHandler(var AMessage); override; |     procedure DefaultHandler(var AMessage); override; | ||||||
|     Procedure DisableAlign; |  | ||||||
|     Procedure EnableAlign; |  | ||||||
|     function  GetTextLen: Integer; override; |     function  GetTextLen: Integer; override; | ||||||
|     Procedure Invalidate; override; |     Procedure Invalidate; override; | ||||||
|     Procedure InsertControl(AControl: TControl); |     Procedure InsertControl(AControl: TControl); | ||||||
|  | |||||||
| @ -1944,8 +1944,9 @@ end; | |||||||
| ------------------------------------------------------------------------------} | ------------------------------------------------------------------------------} | ||||||
| function TControl.AutoSizeDelayed: boolean; | function TControl.AutoSizeDelayed: boolean; | ||||||
| begin | begin | ||||||
|   Result:=// no autosize during loading or destruction |   Result:=(FAutoSizingLockCount>0) | ||||||
|           ([csLoading,csDestroying]*ComponentState<>[]) |           // no autosize during loading or destruction
 | ||||||
|  |           or ([csLoading,csDestroying]*ComponentState<>[]) | ||||||
|           // no autosize for invisible controls
 |           // no autosize for invisible controls
 | ||||||
|           or ((not Visible) and (not (csDesigning in ComponentState))) |           or ((not Visible) and (not (csDesigning in ComponentState))) | ||||||
|           // if there is no parent, then this control is not visible
 |           // if there is no parent, then this control is not visible
 | ||||||
| @ -1956,7 +1957,8 @@ begin | |||||||
|   {$IFDEF VerboseCanAutoSize} |   {$IFDEF VerboseCanAutoSize} | ||||||
|   if Result and AutoSize then begin |   if Result and AutoSize then begin | ||||||
|     DbgOut('TControl.AutoSizeDelayed Self='+DbgSName(Self)+' '); |     DbgOut('TControl.AutoSizeDelayed Self='+DbgSName(Self)+' '); | ||||||
|     if csLoading in ComponentState then debugln('csLoading') |     if FAutoSizingLockCount>0 then debugln('FAutoSizingLockCount=',dbgs(FAutoSizingLockCount)) | ||||||
|  |     else if csLoading in ComponentState then debugln('csLoading') | ||||||
|     else if csDestroying in ComponentState then debugln('csDestroying') |     else if csDestroying in ComponentState then debugln('csDestroying') | ||||||
|     else if not Visible then debugln('Visible') |     else if not Visible then debugln('Visible') | ||||||
|     else if NeedParentForAutoSize and (Parent=nil) then debugln('NeedParentForAutoSize and (Parent=nil)') |     else if NeedParentForAutoSize and (Parent=nil) then debugln('NeedParentForAutoSize and (Parent=nil)') | ||||||
| @ -3512,6 +3514,19 @@ begin | |||||||
|   end; |   end; | ||||||
| end; | end; | ||||||
| 
 | 
 | ||||||
|  | procedure TControl.DisableAutoSizing; | ||||||
|  | begin | ||||||
|  |   inc(FAutoSizingLockCount); | ||||||
|  | end; | ||||||
|  | 
 | ||||||
|  | procedure TControl.EnableAutoSizing; | ||||||
|  | begin | ||||||
|  |   if FAutoSizingLockCount<=0 then RaiseGDBException('TControl.EnableAutoSizing'); | ||||||
|  |   dec(FAutoSizingLockCount); | ||||||
|  |   if FAutoSizingLockCount=0 then | ||||||
|  |     AdjustSize; | ||||||
|  | end; | ||||||
|  | 
 | ||||||
| {------------------------------------------------------------------------------ | {------------------------------------------------------------------------------ | ||||||
|   Method: TControl.WMWindowPosChanged |   Method: TControl.WMWindowPosChanged | ||||||
|   Params:   Msg: The message |   Params:   Msg: The message | ||||||
|  | |||||||
| @ -437,6 +437,8 @@ begin | |||||||
|   DebugLn('TCustomNotebook.InsertPage A ',Name,' Index=',Index,' Name=', |   DebugLn('TCustomNotebook.InsertPage A ',Name,' Index=',Index,' Name=', | ||||||
|     APage.Name,' Caption=',APage.Caption); |     APage.Name,' Caption=',APage.Caption); | ||||||
|   {$ENDIF} |   {$ENDIF} | ||||||
|  |   APage.DisableAutoSizing; | ||||||
|  |   try | ||||||
|     if Index<FPageList.Count then |     if Index<FPageList.Count then | ||||||
|       NewZPosition:=GetControlIndex(TCustomPage(fPageList[Index])) |       NewZPosition:=GetControlIndex(TCustomPage(fPageList[Index])) | ||||||
|     else |     else | ||||||
| @ -463,6 +465,9 @@ begin | |||||||
|       if PageIndex = Index then |       if PageIndex = Index then | ||||||
|         DoSendPageIndex; |         DoSendPageIndex; | ||||||
|     end; |     end; | ||||||
|  |   finally | ||||||
|  |     APage.EnableAutoSizing; | ||||||
|  |   end; | ||||||
|   {$IFDEF NOTEBOOK_DEBUG} |   {$IFDEF NOTEBOOK_DEBUG} | ||||||
|   DebugLn('TCustomNotebook.InsertPage END ',Name,' Index=', |   DebugLn('TCustomNotebook.InsertPage END ',Name,' Index=', | ||||||
|     Index,' Name=',APage.Name,' Caption=',APage.Caption); |     Index,' Name=',APage.Name,' Caption=',APage.Caption); | ||||||
| @ -486,7 +491,8 @@ begin | |||||||
|     TWSCustomNotebookClass(WidgetSetClass).MovePage(Self, APage, NewIndex); |     TWSCustomNotebookClass(WidgetSetClass).MovePage(Self, APage, NewIndex); | ||||||
| end; | end; | ||||||
| 
 | 
 | ||||||
| procedure TCustomNoteBook.ChildPageSetTabVisible(APage: TCustomPage; AValue: Boolean; AIndex: Integer); | procedure TCustomNoteBook.ChildPageSetTabVisible(APage: TCustomPage; | ||||||
|  |   AValue: Boolean; AIndex: Integer); | ||||||
| var | var | ||||||
|   X: Integer; |   X: Integer; | ||||||
|   RealIndex: Integer; |   RealIndex: Integer; | ||||||
|  | |||||||
| @ -34,6 +34,7 @@ function TWinControl.AutoSizeDelayed: boolean; | |||||||
| begin | begin | ||||||
|   Result:=// no handle means not visible |   Result:=// no handle means not visible | ||||||
|           (not HandleAllocated) |           (not HandleAllocated) | ||||||
|  |           or (not FShowing) | ||||||
|           // during handle creation no autosize
 |           // during handle creation no autosize
 | ||||||
|           or (wcfCreatingChildHandles in FWinControlFlags) |           or (wcfCreatingChildHandles in FWinControlFlags) | ||||||
|           or (inherited AutoSizeDelayed); |           or (inherited AutoSizeDelayed); | ||||||
| @ -42,6 +43,7 @@ begin | |||||||
|   if Result and AutoSize then begin |   if Result and AutoSize then begin | ||||||
|     DbgOut('TWinControl.AutoSizeDelayed Self='+DbgSName(Self)+' '); |     DbgOut('TWinControl.AutoSizeDelayed Self='+DbgSName(Self)+' '); | ||||||
|     if not HandleAllocated then debugln('not HandleAllocated') |     if not HandleAllocated then debugln('not HandleAllocated') | ||||||
|  |     else if not FShowing then debugln('not FShowing') | ||||||
|     else if wcfCreatingChildHandles in FWinControlFlags then debugln('wcfCreatingChildHandles') |     else if wcfCreatingChildHandles in FWinControlFlags then debugln('wcfCreatingChildHandles') | ||||||
|     else debugln('inherited AutoSizeDelayed'); |     else debugln('inherited AutoSizeDelayed'); | ||||||
|   end; |   end; | ||||||
| @ -687,6 +689,7 @@ var | |||||||
|   Child: TControl; |   Child: TControl; | ||||||
|   AWinControl: TWinControl; |   AWinControl: TWinControl; | ||||||
| begin | begin | ||||||
|  |   if AutoSizeDelayed then exit; | ||||||
|   for i:=0 to ControlCount-1 do begin |   for i:=0 to ControlCount-1 do begin | ||||||
|     Child:=Controls[i]; |     Child:=Controls[i]; | ||||||
|     if Child.AutoSizeDelayed then continue; |     if Child.AutoSizeDelayed then continue; | ||||||
| @ -1413,6 +1416,8 @@ begin | |||||||
|     if not ok then |     if not ok then | ||||||
|       FShowing := not bShow; |       FShowing := not bShow; | ||||||
|   end; |   end; | ||||||
|  |    | ||||||
|  |   if FShowing then ResizeDelayedAutoSizeChilds; | ||||||
| end; | end; | ||||||
| 
 | 
 | ||||||
| procedure TWinControl.Update; | procedure TWinControl.Update; | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 mattias
						mattias