mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-16 17:29:31 +02:00
fixed updating TScrollBar.Constraints on chaning Kind
git-svn-id: trunk@7682 -
This commit is contained in:
parent
9e4a4eeb01
commit
0a33790987
@ -787,6 +787,7 @@ type
|
|||||||
FPopupMenu: TPopupMenu;
|
FPopupMenu: TPopupMenu;
|
||||||
FPreferredWidth: integer;
|
FPreferredWidth: integer;
|
||||||
FPreferredHeight: integer;
|
FPreferredHeight: integer;
|
||||||
|
FReadBounds: TRect;
|
||||||
FSessionProperties: string;
|
FSessionProperties: string;
|
||||||
FShowHint: Boolean;
|
FShowHint: Boolean;
|
||||||
FSizeLock: integer;
|
FSizeLock: integer;
|
||||||
@ -874,10 +875,6 @@ type
|
|||||||
procedure DoOnChangeBounds; virtual;
|
procedure DoOnChangeBounds; virtual;
|
||||||
procedure Resize; virtual;
|
procedure Resize; virtual;
|
||||||
procedure RequestAlign; dynamic;
|
procedure RequestAlign; dynamic;
|
||||||
procedure UpdateBaseBounds(StoreBounds, StoreParentClientSize,
|
|
||||||
UseLoadedValues: boolean); virtual;
|
|
||||||
procedure LockBaseBounds;
|
|
||||||
procedure UnlockBaseBounds;
|
|
||||||
procedure UpdateAnchorRules;
|
procedure UpdateAnchorRules;
|
||||||
procedure ChangeBounds(ALeft, ATop, AWidth, AHeight: integer); virtual;
|
procedure ChangeBounds(ALeft, ATop, AWidth, AHeight: integer); virtual;
|
||||||
procedure DoSetBounds(ALeft, ATop, AWidth, AHeight: integer); virtual;
|
procedure DoSetBounds(ALeft, ATop, AWidth, AHeight: integer); virtual;
|
||||||
@ -1061,13 +1058,19 @@ type
|
|||||||
procedure SetBounds(aLeft, aTop, aWidth, aHeight: integer); virtual;
|
procedure SetBounds(aLeft, aTop, aWidth, aHeight: integer); virtual;
|
||||||
procedure SetInitialBounds(aLeft, aTop, aWidth, aHeight: integer); virtual;
|
procedure SetInitialBounds(aLeft, aTop, aWidth, aHeight: integer); virtual;
|
||||||
procedure SetBoundsKeepBase(aLeft, aTop, aWidth, aHeight: integer;
|
procedure SetBoundsKeepBase(aLeft, aTop, aWidth, aHeight: integer;
|
||||||
Lock: boolean); virtual;
|
Lock: boolean = true); virtual;
|
||||||
procedure GetPreferredSize(var PreferredWidth, PreferredHeight: integer;
|
procedure GetPreferredSize(var PreferredWidth, PreferredHeight: integer;
|
||||||
Raw: boolean); virtual;
|
Raw: boolean); virtual;
|
||||||
procedure CNPreferredSizeChanged;
|
procedure CNPreferredSizeChanged;
|
||||||
procedure InvalidatePreferredSize; virtual;
|
procedure InvalidatePreferredSize; virtual;
|
||||||
procedure DisableAutoSizing;
|
procedure DisableAutoSizing;
|
||||||
procedure EnableAutoSizing;
|
procedure EnableAutoSizing;
|
||||||
|
procedure UpdateBaseBounds(StoreBounds, StoreParentClientSize,
|
||||||
|
UseLoadedValues: boolean); virtual;
|
||||||
|
procedure LockBaseBounds;
|
||||||
|
procedure UnlockBaseBounds;
|
||||||
|
property BaseBounds: TRect read FBaseBounds;
|
||||||
|
property ReadBounds: TRect read FReadBounds;
|
||||||
public
|
public
|
||||||
constructor Create(TheOwner: TComponent);override;
|
constructor Create(TheOwner: TComponent);override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
|
@ -2496,12 +2496,13 @@ begin
|
|||||||
and (NewBaseParentClientSize.X=FBaseParentClientSize.X)
|
and (NewBaseParentClientSize.X=FBaseParentClientSize.X)
|
||||||
and (NewBaseParentClientSize.Y=FBaseParentClientSize.Y)
|
and (NewBaseParentClientSize.Y=FBaseParentClientSize.Y)
|
||||||
then exit;
|
then exit;
|
||||||
{if csDesigning in ComponentState then
|
//if csDesigning in ComponentState then
|
||||||
DebugLn('TControl.UpdateBaseBounds ',Name,':',ClassName,
|
{if CompareText(ClassName,'TScrollBar')=0 then
|
||||||
' OldBounds=',FBaseBounds.Left,',',FBaseBounds.Top,',',FBaseBounds.Right-FBaseBounds.Left,',',FBaseBounds.Bottom-FBaseBounds.Top,
|
DebugLn('TControl.UpdateBaseBounds '+dbgs(Self)+
|
||||||
' OldClientSize=',FBaseParentClientSize.X,',',FBaseParentClientSize.Y,
|
' OldBounds='+dbgs(FBaseBounds)+
|
||||||
' NewBounds=',NewBaseBounds.Left,',',NewBaseBounds.Top,',',NewBaseBounds.Right-NewBaseBounds.Left,',',NewBaseBounds.Bottom-NewBaseBounds.Top,
|
' OldClientSize='+dbgs(FBaseParentClientSize)+
|
||||||
' NewClientSize=',NewBaseParentClientSize.X,',',NewBaseParentClientSize.Y,
|
' NewBounds='+dbgs(NewBaseBounds)+
|
||||||
|
' NewClientSize='+dbgs(NewBaseParentClientSize)+
|
||||||
'');}
|
'');}
|
||||||
FBaseBounds:=NewBaseBounds;
|
FBaseBounds:=NewBaseBounds;
|
||||||
FBaseParentClientSize:=NewBaseParentClientSize;
|
FBaseParentClientSize:=NewBaseParentClientSize;
|
||||||
@ -2568,6 +2569,10 @@ begin
|
|||||||
{$IFDEF CHECK_POSITION}
|
{$IFDEF CHECK_POSITION}
|
||||||
DebugLn('[TControl.SetLeft] ',Name,':',ClassName,' ',Value);
|
DebugLn('[TControl.SetLeft] ',Name,':',ClassName,' ',Value);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
if csLoading in ComponentState then begin
|
||||||
|
inc(FReadBounds.Right,Value-FReadBounds.Left);
|
||||||
|
FReadBounds.Left:=Value;
|
||||||
|
end;
|
||||||
SetBounds(Value, FTop, FWidth, FHeight);
|
SetBounds(Value, FTop, FWidth, FHeight);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -2579,6 +2584,10 @@ begin
|
|||||||
{$IFDEF CHECK_POSITION}
|
{$IFDEF CHECK_POSITION}
|
||||||
DebugLn('[TControl.SetTop] ',Name,':',ClassName,' ',Value);
|
DebugLn('[TControl.SetTop] ',Name,':',ClassName,' ',Value);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
if csLoading in ComponentState then begin
|
||||||
|
inc(FReadBounds.Bottom,Value-FReadBounds.Top);
|
||||||
|
FReadBounds.Top:=Value;
|
||||||
|
end;
|
||||||
SetBounds(FLeft, Value, FWidth, FHeight);
|
SetBounds(FLeft, Value, FWidth, FHeight);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -2602,8 +2611,10 @@ procedure TControl.SetWidth(Value: Integer);
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
{$IFDEF CHECK_POSITION}
|
{$IFDEF CHECK_POSITION}
|
||||||
DebugLn('[TControl.SetWidth] ',Name,':',ClassName,' ',Value);
|
DebugLn('[TControl.SetWidth] ',Name,':',ClassName,' ',dbgs(Value));
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
if csLoading in ComponentState then
|
||||||
|
FReadBounds.Right:=FReadBounds.Left+Value;
|
||||||
if [csDesigning,csDestroying,csLoading]*ComponentState=[csDesigning] then
|
if [csDesigning,csDestroying,csLoading]*ComponentState=[csDesigning] then
|
||||||
CheckDesignBounds;
|
CheckDesignBounds;
|
||||||
SetBounds(FLeft, FTop, Max(0,Value), FHeight);
|
SetBounds(FLeft, FTop, Max(0,Value), FHeight);
|
||||||
@ -2629,8 +2640,10 @@ procedure TControl.SetHeight(Value: Integer);
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
{$IFDEF CHECK_POSITION}
|
{$IFDEF CHECK_POSITION}
|
||||||
DebugLn('[TControl.SetHeight] ',Name,':',ClassName,' ',Value);
|
DebugLn('[TControl.SetHeight] ',Name,':',ClassName,' ',dbgs(Value));
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
if csLoading in ComponentState then
|
||||||
|
FReadBounds.Bottom:=FReadBounds.Top+Value;
|
||||||
if [csDesigning,csDestroying,csLoading]*ComponentState=[csDesigning] then
|
if [csDesigning,csDestroying,csLoading]*ComponentState=[csDesigning] then
|
||||||
CheckDesignBounds;
|
CheckDesignBounds;
|
||||||
SetBounds(FLeft, FTop, FWidth, Max(0,Value));
|
SetBounds(FLeft, FTop, FWidth, Max(0,Value));
|
||||||
|
@ -80,15 +80,23 @@ var
|
|||||||
OldWidth: Integer;
|
OldWidth: Integer;
|
||||||
OldHeight: Integer;
|
OldHeight: Integer;
|
||||||
begin
|
begin
|
||||||
if FKind <> Value then
|
if FKind <> Value then begin
|
||||||
begin
|
|
||||||
FKind := Value;
|
FKind := Value;
|
||||||
// switch width and height
|
// switch width and height
|
||||||
OldWidth:=Width;
|
OldWidth:=Width;
|
||||||
OldHeight:=Height;
|
OldHeight:=Height;
|
||||||
|
if csLoading in ComponentState then begin
|
||||||
|
if ReadBounds.Right>ReadBounds.Left then
|
||||||
|
OldWidth:=ReadBounds.Right-ReadBounds.Left;
|
||||||
|
if ReadBounds.Bottom>ReadBounds.Top then
|
||||||
|
OldHeight:=ReadBounds.Bottom-ReadBounds.Top;
|
||||||
|
//debugln('TCustomScrollBar.SetKind ',DbgSName(Self),' ',dbgs(ReadBounds),' OldWidth=',dbgs(OldWidth),' OldHeight=',dbgs(OldHeight));
|
||||||
|
end;
|
||||||
// TODO: Remove RecreateWnd
|
// TODO: Remove RecreateWnd
|
||||||
if HandleAllocated
|
if HandleAllocated then
|
||||||
then RecreateWnd(Self);
|
RecreateWnd(Self)
|
||||||
|
else
|
||||||
|
Constraints.UpdateInterfaceConstraints;
|
||||||
SetBounds(Left,Top,OldHeight,OldWidth);
|
SetBounds(Left,Top,OldHeight,OldWidth);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
@ -201,7 +201,7 @@ var
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
{$IFDEF CHECK_POSITION}
|
{$IFDEF CHECK_POSITION}
|
||||||
if AnsiCompareText(Control.ClassName,'TScrollBar')=0 then
|
if CompareText(Control.ClassName,'TScrollBar')=0 then
|
||||||
with Control do
|
with Control do
|
||||||
DebugLn('[TWinControl.AlignControls.DoPosition] A Control=',Name,':',ClassName,' ',dbgs(Left),',',dbgs(Top),',',dbgs(Width),',',dbgs(Height),' recalculate the anchors=',dbgs(Control.Anchors <> AnchorAlign[AAlign]),' Align=',AlignNames[AAlign]);
|
DebugLn('[TWinControl.AlignControls.DoPosition] A Control=',Name,':',ClassName,' ',dbgs(Left),',',dbgs(Top),',',dbgs(Width),',',dbgs(Height),' recalculate the anchors=',dbgs(Control.Anchors <> AnchorAlign[AAlign]),' Align=',AlignNames[AAlign]);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
@ -3887,6 +3887,7 @@ begin
|
|||||||
FHandle := TWSWinControlClass(WidgetSetClass).CreateHandle(Self, Params);
|
FHandle := TWSWinControlClass(WidgetSetClass).CreateHandle(Self, Params);
|
||||||
if not HandleAllocated then
|
if not HandleAllocated then
|
||||||
RaiseGDBException('Handle creation failed creating '+DbgSName(Self));
|
RaiseGDBException('Handle creation failed creating '+DbgSName(Self));
|
||||||
|
//debugln('TWinControl.CreateWnd ',DbgSName(Self));
|
||||||
Constraints.UpdateInterfaceConstraints;
|
Constraints.UpdateInterfaceConstraints;
|
||||||
InvalidatePreferredSize;
|
InvalidatePreferredSize;
|
||||||
TWSWinControlClass(WidgetSetClass).ConstraintsChange(Self);
|
TWSWinControlClass(WidgetSetClass).ConstraintsChange(Self);
|
||||||
@ -3932,28 +3933,6 @@ begin
|
|||||||
//WriteClientRect('D');
|
//WriteClientRect('D');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
|
||||||
procedure TWinControl.CreateComponent(TheOwner : TComponent);
|
|
||||||
------------------------------------------------------------------------------}
|
|
||||||
(*
|
|
||||||
procedure TWinControl.CreateComponent(TheOwner : TComponent);
|
|
||||||
|
|
||||||
procedure RaiseError(const Msg: string);
|
|
||||||
begin
|
|
||||||
RaiseGDBException('TWinControl.CreateComponent: '+Name+':'+ClassName+' '+Msg);
|
|
||||||
end;
|
|
||||||
|
|
||||||
begin
|
|
||||||
if HandleAllocated then
|
|
||||||
RaiseError('Handle already created');
|
|
||||||
CNSendMessage(LM_CREATE, Self, nil);
|
|
||||||
Constraints.UpdateInterfaceConstraints;
|
|
||||||
FFlags:=FFlags-[wcfColorChanged,wcfFontChanged];
|
|
||||||
if not HandleAllocated then
|
|
||||||
RaiseError('Handle creation failed');
|
|
||||||
end;
|
|
||||||
*)
|
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
TWinControl Destroy Component
|
TWinControl Destroy Component
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
|
@ -168,7 +168,7 @@ begin
|
|||||||
Widget:=GetStyleWidget(lgsVerticalScrollbar);
|
Widget:=GetStyleWidget(lgsVerticalScrollbar);
|
||||||
MinWidth:=Widget^.requisition.Width;
|
MinWidth:=Widget^.requisition.Width;
|
||||||
end;
|
end;
|
||||||
//DebugLn('TGtkWidgetSet.GetControlConstraints A ',MinWidth,',',MinHeight,' ',TScrollBar(SizeConstraints.Control).Kind=sbHorizontal,' ',TScrollBar(SizeConstraints.Control).Name);
|
//DebugLn('TGtkWidgetSet.GetControlConstraints A '+dbgs(MinWidth)+','+dbgs(MinHeight),' ',dbgs(TScrollBar(SizeConstraints.Control).Kind=sbHorizontal),' ',TScrollBar(SizeConstraints.Control).Name);
|
||||||
SizeConstraints.SetInterfaceConstraints(MinWidth,MinHeight,
|
SizeConstraints.SetInterfaceConstraints(MinWidth,MinHeight,
|
||||||
MinWidth,MinHeight);
|
MinWidth,MinHeight);
|
||||||
exit;
|
exit;
|
||||||
|
Loading…
Reference in New Issue
Block a user