mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-03 16:00:28 +02:00
LCL: carbon: GetPreferredSize: do not use GetBestControlRect if there are child controls
git-svn-id: trunk@47913 -
This commit is contained in:
parent
74dd6d36d0
commit
94aa787b23
@ -186,6 +186,7 @@ type
|
||||
procedure SetScrollBars(const AValue: TScrollStyle);
|
||||
protected
|
||||
function GetFrame({%H-}Index: Integer): ControlRef; override;
|
||||
function GetPreferredSize: TPoint; override;
|
||||
procedure CreateWidget(const AParams: TCreateParams); override;
|
||||
procedure DestroyWidget; override;
|
||||
procedure GetLineOffset(AIndex: Integer; out AStart, AEnd: TXNOffset);
|
||||
@ -1526,6 +1527,11 @@ begin
|
||||
Result:=FBorder;
|
||||
end;
|
||||
|
||||
function TCarbonMemo.GetPreferredSize: TPoint;
|
||||
begin
|
||||
Result.X:=0;
|
||||
Result.Y:=0;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: TCarbonMemo.CreateWidget
|
||||
|
@ -1747,7 +1747,7 @@ end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: TCarbonControl.GetPreferredSize
|
||||
Returns: The preffered size of control for autosizing or (0, 0)
|
||||
Returns: The prefered size of control for autosizing or (0, 0)
|
||||
------------------------------------------------------------------------------}
|
||||
function TCarbonControl.GetPreferredSize: TPoint;
|
||||
var
|
||||
@ -1757,12 +1757,17 @@ begin
|
||||
Result.X := 0;
|
||||
Result.Y := 0;
|
||||
|
||||
R := GetCarbonRect(0, 0, 0, 0);
|
||||
|
||||
if OSError(GetBestControlRect(ControlRef(Widget), R, S{%H-}), Self,
|
||||
'GetPreferredSize', 'GetBestControlRect') then Exit;
|
||||
if (LCLObject is TWinControl) and (TWinControl(LCLObject).ControlCount>0) then
|
||||
begin
|
||||
|
||||
Result.X := R.right - R.left;
|
||||
Result.Y := R.bottom - R.top;
|
||||
end else begin
|
||||
R := GetCarbonRect(0, 0, 0, 0);
|
||||
|
||||
if OSError(GetBestControlRect(ControlRef(Widget), R, S{%H-}), Self,
|
||||
'GetPreferredSize', 'GetBestControlRect') then Exit;
|
||||
|
||||
Result.X := R.right - R.left;
|
||||
Result.Y := R.bottom - R.top;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user