From 87bc6b39312c23eb6c9368e2c4f85f0343968fc9 Mon Sep 17 00:00:00 2001 From: mattias Date: Thu, 30 Jun 2005 19:39:04 +0000 Subject: [PATCH] added AutoSizeDelayed check for controls without form parents git-svn-id: trunk@7307 - --- doceditor/frmbuild.lrs | 2 -- doceditor/frmexample.lrs | 2 -- doceditor/frmmakeskel.lrs | 2 -- doceditor/lazde.lpi | 38 +++++++++++++++++++------------------- lcl/controls.pp | 5 ++++- lcl/forms.pp | 1 + lcl/include/bitbtn.inc | 14 +++++++------- lcl/include/control.inc | 12 +++++++++++- lcl/include/customform.inc | 17 +++++++++++++++++ lcl/include/wincontrol.inc | 7 ++++++- 10 files changed, 65 insertions(+), 35 deletions(-) diff --git a/doceditor/frmbuild.lrs b/doceditor/frmbuild.lrs index 054e6c109d..a04e43094d 100644 --- a/doceditor/frmbuild.lrs +++ b/doceditor/frmbuild.lrs @@ -1,5 +1,3 @@ -{ This is an automatically generated lazarus resource file } - LazarusResources.Add('TBuildForm','FORMDATA',[ 'TPF0'#10'TBuildForm'#9'BuildForm'#7'Caption'#6#19'Build documentation'#12'Cl' +'ientHeight'#3'Q'#1#11'ClientWidth'#3#154#1#12'OnCloseQuery'#7#19'BuildFormC' diff --git a/doceditor/frmexample.lrs b/doceditor/frmexample.lrs index af9e99b6d7..d5de455f52 100644 --- a/doceditor/frmexample.lrs +++ b/doceditor/frmexample.lrs @@ -1,5 +1,3 @@ -{ This is an automatically generated lazarus resource file } - LazarusResources.Add('TExampleForm','FORMDATA',[ 'TPF0'#12'TExampleForm'#11'ExampleForm'#7'Caption'#6#12'Example file'#12'Clie' +'ntHeight'#2'U'#11'ClientWidth'#3#148#1#13'PixelsPerInch'#2'Z'#18'HorzScroll' diff --git a/doceditor/frmmakeskel.lrs b/doceditor/frmmakeskel.lrs index 6ebc9480d6..9d700e98a9 100644 --- a/doceditor/frmmakeskel.lrs +++ b/doceditor/frmmakeskel.lrs @@ -1,5 +1,3 @@ -{ This is an automatically generated lazarus resource file } - LazarusResources.Add('TMakeSkelForm','FORMDATA',[ 'TPF0'#13'TMakeSkelForm'#12'MakeSkelForm'#7'Caption'#6'"Create new file from ' +'pascal source'#12'ClientHeight'#3#21#1#11'ClientWidth'#3#157#1#13'PixelsPer' diff --git a/doceditor/lazde.lpi b/doceditor/lazde.lpi index 911551a19f..69fda6c83f 100644 --- a/doceditor/lazde.lpi +++ b/doceditor/lazde.lpi @@ -8,7 +8,7 @@ - + @@ -21,10 +21,10 @@ - + - + @@ -33,7 +33,7 @@ - + @@ -45,7 +45,7 @@ - + @@ -57,7 +57,7 @@ - + @@ -69,7 +69,7 @@ - + @@ -81,7 +81,7 @@ - + @@ -93,7 +93,7 @@ - + @@ -105,17 +105,17 @@ - + - + - + @@ -125,17 +125,17 @@ - + - + - + @@ -147,19 +147,19 @@ - + - + - + - + diff --git a/lcl/controls.pp b/lcl/controls.pp index b99826e601..311182c817 100644 --- a/lcl/controls.pp +++ b/lcl/controls.pp @@ -1348,7 +1348,6 @@ type FClientHeight: Integer; FDockManager: TDockManager; FDockSite: Boolean; - FWinControlFlags: TWinControlFlags; FOnDockDrop: TDockDropEvent; FOnDockOver: TDockOverEvent; FOnGetSiteInfo: TGetSiteInfoEvent; @@ -1393,6 +1392,7 @@ type procedure UpdateTabOrder(NewTabOrder: TTabOrder); function WantsKeyBeforeInterface(Key: word; Shift: TShiftState): boolean; protected + FWinControlFlags: TWinControlFlags; procedure AssignTo(Dest: TPersistent); override; procedure ActionChange(Sender: TObject; CheckDefaults: Boolean); override; function GetActionLinkClass: TControlActionLinkClass; override; @@ -2914,6 +2914,9 @@ end. { ============================================================================= $Log$ + Revision 1.303 2005/06/30 19:39:03 mattias + added AutoSizeDelayed check for controls without form parents + Revision 1.302 2005/06/25 15:34:03 mattias fixed a few fpc over warnings from Andrew Haines diff --git a/lcl/forms.pp b/lcl/forms.pp index fe24a9ce36..7ad2fd6e26 100644 --- a/lcl/forms.pp +++ b/lcl/forms.pp @@ -476,6 +476,7 @@ type procedure Hide; procedure Show; procedure ShowOnTop; + function AutoSizeDelayed: boolean; override; function WantChildKey(Child : TControl; var Message : TLMessage): Boolean; virtual; procedure DefocusControl(Control: TWinControl; Removing: Boolean); diff --git a/lcl/include/bitbtn.inc b/lcl/include/bitbtn.inc index 014f11e1b3..ae5d3d1a28 100644 --- a/lcl/include/bitbtn.inc +++ b/lcl/include/bitbtn.inc @@ -15,9 +15,9 @@ ***************************************************************************** } -{------------------------------------------------------------------------------} -{ TCustomBitBtn Constructor } -{------------------------------------------------------------------------------} +{------------------------------------------------------------------------------ + TCustomBitBtn Constructor +------------------------------------------------------------------------------} constructor TCustomBitBtn.Create(TheOwner: TComponent); begin inherited Create(TheOwner); @@ -29,13 +29,13 @@ begin FButtonGlyph := TButtonGlyph.Create; FButtonGlyph.OnChange := @GlyphChanged; Align := alNone; - SetInitialBounds(0,0,75,35); + SetInitialBounds(0,0,75,30); RealizeKind; end; -{------------------------------------------------------------------------------} -{ TCustomBitBtn destructor } -{------------------------------------------------------------------------------} +{------------------------------------------------------------------------------ + TCustomBitBtn destructor +------------------------------------------------------------------------------} destructor TCustomBitBtn.Destroy; Begin FreeThenNil(FButtonGlyph); diff --git a/lcl/include/control.inc b/lcl/include/control.inc index a23e2b60c8..b17404d25a 100644 --- a/lcl/include/control.inc +++ b/lcl/include/control.inc @@ -1918,7 +1918,14 @@ end; ------------------------------------------------------------------------------} function TControl.AutoSizeDelayed: boolean; begin - Result:=(csLoading in ComponentState) + Result:=// no autosize during loading or destruction + ([csLoading,csDestroying]*ComponentState<>[]) + // no autosize for invisible controls + or (not Visible) + // if there is no parent, then this control is not visible + // (TCustomForm will override this) + or (Parent=nil) + // if there is a parent, ask it or ((Parent<>nil) and Parent.AutoSizeDelayed); end; @@ -3541,6 +3548,9 @@ end; { ============================================================================= $Log$ + Revision 1.262 2005/06/30 19:39:04 mattias + added AutoSizeDelayed check for controls without form parents + Revision 1.261 2005/06/25 15:30:33 mattias fixed changing BorderSpacing at designtime and borderspacing Align=alTop,alLeft diff --git a/lcl/include/customform.inc b/lcl/include/customform.inc index 214f00a663..1429f39e1a 100644 --- a/lcl/include/customform.inc +++ b/lcl/include/customform.inc @@ -1416,6 +1416,20 @@ begin //DebugLn('TCustomForm.ShowOnTop ',Name,':',ClassName,' ',Visible,' ',HandleAllocated,' ',csDesigning in ComponentState); end; +function TCustomForm.AutoSizeDelayed: boolean; +begin + Result:=// no autosize during loading or destruction + ([csLoading,csDestroying]*ComponentState<>[]) + // no handle means not visible + or (not HandleAllocated) + // during handle creation no autosize + or (wcfCreatingChildHandles in FWinControlFlags) + // no autosize for invisible forms + or (not Visible) + // if there is a parent, ask it + or ((Parent<>nil) and Parent.AutoSizeDelayed); +end; + {------------------------------------------------------------------------------ TCustomForm Method IsForm ------------------------------------------------------------------------------} @@ -1934,6 +1948,9 @@ end; { ============================================================================= $Log$ + Revision 1.187 2005/06/30 19:39:04 mattias + added AutoSizeDelayed check for controls without form parents + Revision 1.186 2005/06/02 20:31:19 micha fix lm_showwindow handling to not fire onshow event in case of restore and unzoom (fixes bug 928) diff --git a/lcl/include/wincontrol.inc b/lcl/include/wincontrol.inc index 27d7afc5e8..1211803d65 100644 --- a/lcl/include/wincontrol.inc +++ b/lcl/include/wincontrol.inc @@ -55,7 +55,9 @@ end; ------------------------------------------------------------------------------} function TWinControl.AutoSizeDelayed: boolean; begin - Result:=(not HandleAllocated) + Result:=// no handle means not visible + (not HandleAllocated) + // during handle creation no autosize or (wcfCreatingChildHandles in FWinControlFlags) or (inherited AutoSizeDelayed); //if Result then debugln('TWinControl.AutoSizeDelayed A ',DbgSName(Self),' wcfCreatingChildHandles=',dbgs(wcfCreatingChildHandles in FWinControlFlags),' csLoading=',dbgs(csLoading in ComponentState)); @@ -4543,6 +4545,9 @@ end; { ============================================================================= $Log$ + Revision 1.332 2005/06/30 19:39:04 mattias + added AutoSizeDelayed check for controls without form parents + Revision 1.331 2005/06/29 22:52:39 mattias started add new unit page for package editor