added AutoSizeDelayed check for controls without form parents

git-svn-id: trunk@7307 -
This commit is contained in:
mattias 2005-06-30 19:39:04 +00:00
parent a554366f8a
commit 87bc6b3931
10 changed files with 65 additions and 35 deletions

View File

@ -1,5 +1,3 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TBuildForm','FORMDATA',[ LazarusResources.Add('TBuildForm','FORMDATA',[
'TPF0'#10'TBuildForm'#9'BuildForm'#7'Caption'#6#19'Build documentation'#12'Cl' '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' +'ientHeight'#3'Q'#1#11'ClientWidth'#3#154#1#12'OnCloseQuery'#7#19'BuildFormC'

View File

@ -1,5 +1,3 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TExampleForm','FORMDATA',[ LazarusResources.Add('TExampleForm','FORMDATA',[
'TPF0'#12'TExampleForm'#11'ExampleForm'#7'Caption'#6#12'Example file'#12'Clie' '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' +'ntHeight'#2'U'#11'ClientWidth'#3#148#1#13'PixelsPerInch'#2'Z'#18'HorzScroll'

View File

@ -1,5 +1,3 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TMakeSkelForm','FORMDATA',[ LazarusResources.Add('TMakeSkelForm','FORMDATA',[
'TPF0'#13'TMakeSkelForm'#12'MakeSkelForm'#7'Caption'#6'"Create new file from ' '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' +'pascal source'#12'ClientHeight'#3#21#1#11'ClientWidth'#3#157#1#13'PixelsPer'

View File

@ -8,7 +8,7 @@
<SaveOnlyProjectUnits Value="True"/> <SaveOnlyProjectUnits Value="True"/>
</Flags> </Flags>
<MainUnit Value="0"/> <MainUnit Value="0"/>
<ActiveEditorIndexAtStart Value="4"/> <ActiveEditorIndexAtStart Value="12"/>
<AutoCreateForms Value="False"/> <AutoCreateForms Value="False"/>
<IconPath Value="./"/> <IconPath Value="./"/>
<TargetFileExt Value=".exe"/> <TargetFileExt Value=".exe"/>
@ -21,10 +21,10 @@
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<UnitName Value="lazde"/> <UnitName Value="lazde"/>
<UsageCount Value="96"/> <UsageCount Value="97"/>
</Unit0> </Unit0>
<Unit1> <Unit1>
<CursorPos X="11" Y="22"/> <CursorPos X="17" Y="21"/>
<EditorIndex Value="4"/> <EditorIndex Value="4"/>
<Filename Value="frmmain.pp"/> <Filename Value="frmmain.pp"/>
<ComponentName Value="MainForm"/> <ComponentName Value="MainForm"/>
@ -33,7 +33,7 @@
<ResourceFilename Value="frmmain.lrs"/> <ResourceFilename Value="frmmain.lrs"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<UnitName Value="FrmMain"/> <UnitName Value="FrmMain"/>
<UsageCount Value="96"/> <UsageCount Value="97"/>
</Unit1> </Unit1>
<Unit2> <Unit2>
<CursorPos X="1" Y="23"/> <CursorPos X="1" Y="23"/>
@ -45,7 +45,7 @@
<ResourceFilename Value="frmoptions.lrs"/> <ResourceFilename Value="frmoptions.lrs"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<UnitName Value="frmOptions"/> <UnitName Value="frmOptions"/>
<UsageCount Value="93"/> <UsageCount Value="94"/>
</Unit2> </Unit2>
<Unit3> <Unit3>
<CursorPos X="1" Y="23"/> <CursorPos X="1" Y="23"/>
@ -57,7 +57,7 @@
<ResourceFilename Value="frmnewnode.lrs"/> <ResourceFilename Value="frmnewnode.lrs"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<UnitName Value="frmNewNode"/> <UnitName Value="frmNewNode"/>
<UsageCount Value="90"/> <UsageCount Value="91"/>
</Unit3> </Unit3>
<Unit4> <Unit4>
<CursorPos X="32" Y="27"/> <CursorPos X="32" Y="27"/>
@ -69,7 +69,7 @@
<ResourceFilename Value="frmmakeskel.lrs"/> <ResourceFilename Value="frmmakeskel.lrs"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<UnitName Value="FrmMakeSkel"/> <UnitName Value="FrmMakeSkel"/>
<UsageCount Value="67"/> <UsageCount Value="68"/>
</Unit4> </Unit4>
<Unit5> <Unit5>
<CursorPos X="11" Y="16"/> <CursorPos X="11" Y="16"/>
@ -81,7 +81,7 @@
<ResourceFilename Value="frmlink.lrs"/> <ResourceFilename Value="frmlink.lrs"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<UnitName Value="FrmLink"/> <UnitName Value="FrmLink"/>
<UsageCount Value="60"/> <UsageCount Value="61"/>
</Unit5> </Unit5>
<Unit6> <Unit6>
<CursorPos X="1" Y="23"/> <CursorPos X="1" Y="23"/>
@ -93,7 +93,7 @@
<ResourceFilename Value="frmtable.lrs"/> <ResourceFilename Value="frmtable.lrs"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<UnitName Value="frmTable"/> <UnitName Value="frmTable"/>
<UsageCount Value="60"/> <UsageCount Value="61"/>
</Unit6> </Unit6>
<Unit7> <Unit7>
<CursorPos X="35" Y="26"/> <CursorPos X="35" Y="26"/>
@ -105,17 +105,17 @@
<ResourceFilename Value="frmabout.lrs"/> <ResourceFilename Value="frmabout.lrs"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<UnitName Value="FrmAbout"/> <UnitName Value="FrmAbout"/>
<UsageCount Value="51"/> <UsageCount Value="52"/>
</Unit7> </Unit7>
<Unit8> <Unit8>
<CursorPos X="28" Y="29"/> <CursorPos X="28" Y="29"/>
<EditorIndex Value="11"/> <EditorIndex Value="17"/>
<Filename Value="pkeditor.pp"/> <Filename Value="pkeditor.pp"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<Loaded Value="True"/> <Loaded Value="True"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<UnitName Value="PkEditor"/> <UnitName Value="PkEditor"/>
<UsageCount Value="45"/> <UsageCount Value="46"/>
</Unit8> </Unit8>
<Unit9> <Unit9>
<CursorPos X="21" Y="24"/> <CursorPos X="21" Y="24"/>
@ -125,17 +125,17 @@
<Loaded Value="True"/> <Loaded Value="True"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<UnitName Value="ElEditor"/> <UnitName Value="ElEditor"/>
<UsageCount Value="45"/> <UsageCount Value="46"/>
</Unit9> </Unit9>
<Unit10> <Unit10>
<CursorPos X="34" Y="28"/> <CursorPos X="34" Y="28"/>
<EditorIndex Value="10"/> <EditorIndex Value="16"/>
<Filename Value="fpdeutil.pp"/> <Filename Value="fpdeutil.pp"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<Loaded Value="True"/> <Loaded Value="True"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<UnitName Value="FPDEUtil"/> <UnitName Value="FPDEUtil"/>
<UsageCount Value="45"/> <UsageCount Value="46"/>
</Unit10> </Unit10>
<Unit11> <Unit11>
<CursorPos X="30" Y="9"/> <CursorPos X="30" Y="9"/>
@ -147,19 +147,19 @@
<ResourceFilename Value="frmexample.lrs"/> <ResourceFilename Value="frmexample.lrs"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<UnitName Value="FrmExample"/> <UnitName Value="FrmExample"/>
<UsageCount Value="36"/> <UsageCount Value="37"/>
</Unit11> </Unit11>
<Unit12> <Unit12>
<CursorPos X="35" Y="25"/> <CursorPos X="14" Y="665"/>
<EditorIndex Value="9"/> <EditorIndex Value="9"/>
<Filename Value="frmbuild.pp"/> <Filename Value="frmbuild.pp"/>
<ComponentName Value="BuildForm"/> <ComponentName Value="BuildForm"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<Loaded Value="True"/> <Loaded Value="True"/>
<ResourceFilename Value="frmbuild.lrs"/> <ResourceFilename Value="frmbuild.lrs"/>
<TopLine Value="1"/> <TopLine Value="655"/>
<UnitName Value="frmBuild"/> <UnitName Value="frmBuild"/>
<UsageCount Value="31"/> <UsageCount Value="32"/>
</Unit12> </Unit12>
</Units> </Units>
<PublishOptions> <PublishOptions>

View File

@ -1348,7 +1348,6 @@ type
FClientHeight: Integer; FClientHeight: Integer;
FDockManager: TDockManager; FDockManager: TDockManager;
FDockSite: Boolean; FDockSite: Boolean;
FWinControlFlags: TWinControlFlags;
FOnDockDrop: TDockDropEvent; FOnDockDrop: TDockDropEvent;
FOnDockOver: TDockOverEvent; FOnDockOver: TDockOverEvent;
FOnGetSiteInfo: TGetSiteInfoEvent; FOnGetSiteInfo: TGetSiteInfoEvent;
@ -1393,6 +1392,7 @@ type
procedure UpdateTabOrder(NewTabOrder: TTabOrder); procedure UpdateTabOrder(NewTabOrder: TTabOrder);
function WantsKeyBeforeInterface(Key: word; Shift: TShiftState): boolean; function WantsKeyBeforeInterface(Key: word; Shift: TShiftState): boolean;
protected protected
FWinControlFlags: TWinControlFlags;
procedure AssignTo(Dest: TPersistent); override; procedure AssignTo(Dest: TPersistent); override;
procedure ActionChange(Sender: TObject; CheckDefaults: Boolean); override; procedure ActionChange(Sender: TObject; CheckDefaults: Boolean); override;
function GetActionLinkClass: TControlActionLinkClass; override; function GetActionLinkClass: TControlActionLinkClass; override;
@ -2914,6 +2914,9 @@ end.
{ ============================================================================= { =============================================================================
$Log$ $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 Revision 1.302 2005/06/25 15:34:03 mattias
fixed a few fpc over warnings from Andrew Haines fixed a few fpc over warnings from Andrew Haines

View File

@ -476,6 +476,7 @@ type
procedure Hide; procedure Hide;
procedure Show; procedure Show;
procedure ShowOnTop; procedure ShowOnTop;
function AutoSizeDelayed: boolean; override;
function WantChildKey(Child : TControl; function WantChildKey(Child : TControl;
var Message : TLMessage): Boolean; virtual; var Message : TLMessage): Boolean; virtual;
procedure DefocusControl(Control: TWinControl; Removing: Boolean); procedure DefocusControl(Control: TWinControl; Removing: Boolean);

View File

@ -15,9 +15,9 @@
***************************************************************************** *****************************************************************************
} }
{------------------------------------------------------------------------------} {------------------------------------------------------------------------------
{ TCustomBitBtn Constructor } TCustomBitBtn Constructor
{------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
constructor TCustomBitBtn.Create(TheOwner: TComponent); constructor TCustomBitBtn.Create(TheOwner: TComponent);
begin begin
inherited Create(TheOwner); inherited Create(TheOwner);
@ -29,13 +29,13 @@ begin
FButtonGlyph := TButtonGlyph.Create; FButtonGlyph := TButtonGlyph.Create;
FButtonGlyph.OnChange := @GlyphChanged; FButtonGlyph.OnChange := @GlyphChanged;
Align := alNone; Align := alNone;
SetInitialBounds(0,0,75,35); SetInitialBounds(0,0,75,30);
RealizeKind; RealizeKind;
end; end;
{------------------------------------------------------------------------------} {------------------------------------------------------------------------------
{ TCustomBitBtn destructor } TCustomBitBtn destructor
{------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
destructor TCustomBitBtn.Destroy; destructor TCustomBitBtn.Destroy;
Begin Begin
FreeThenNil(FButtonGlyph); FreeThenNil(FButtonGlyph);

View File

@ -1918,7 +1918,14 @@ end;
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
function TControl.AutoSizeDelayed: boolean; function TControl.AutoSizeDelayed: boolean;
begin 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); or ((Parent<>nil) and Parent.AutoSizeDelayed);
end; end;
@ -3541,6 +3548,9 @@ end;
{ ============================================================================= { =============================================================================
$Log$ $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 Revision 1.261 2005/06/25 15:30:33 mattias
fixed changing BorderSpacing at designtime and borderspacing Align=alTop,alLeft fixed changing BorderSpacing at designtime and borderspacing Align=alTop,alLeft

View File

@ -1416,6 +1416,20 @@ begin
//DebugLn('TCustomForm.ShowOnTop ',Name,':',ClassName,' ',Visible,' ',HandleAllocated,' ',csDesigning in ComponentState); //DebugLn('TCustomForm.ShowOnTop ',Name,':',ClassName,' ',Visible,' ',HandleAllocated,' ',csDesigning in ComponentState);
end; 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 TCustomForm Method IsForm
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
@ -1934,6 +1948,9 @@ end;
{ ============================================================================= { =============================================================================
$Log$ $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 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) fix lm_showwindow handling to not fire onshow event in case of restore and unzoom (fixes bug 928)

View File

@ -55,7 +55,9 @@ end;
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
function TWinControl.AutoSizeDelayed: boolean; function TWinControl.AutoSizeDelayed: boolean;
begin begin
Result:=(not HandleAllocated) Result:=// no handle means not visible
(not HandleAllocated)
// during handle creation no autosize
or (wcfCreatingChildHandles in FWinControlFlags) or (wcfCreatingChildHandles in FWinControlFlags)
or (inherited AutoSizeDelayed); or (inherited AutoSizeDelayed);
//if Result then debugln('TWinControl.AutoSizeDelayed A ',DbgSName(Self),' wcfCreatingChildHandles=',dbgs(wcfCreatingChildHandles in FWinControlFlags),' csLoading=',dbgs(csLoading in ComponentState)); //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$ $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 Revision 1.331 2005/06/29 22:52:39 mattias
started add new unit page for package editor started add new unit page for package editor