diff --git a/Source/Alcinoe.FMX.Common.pas b/Source/Alcinoe.FMX.Common.pas index 5f1f3ee5..8ec262ce 100644 --- a/Source/Alcinoe.FMX.Common.pas +++ b/Source/Alcinoe.FMX.Common.pas @@ -5354,53 +5354,116 @@ procedure ALAutoSize(const AControl: TControl); for var LChildControl in AControl.Controls do begin if (csDesigning in AControl.ComponentState) and (LChildControl.ClassName = 'TGrabHandle.TGrabHandleRectangle') then continue; - case LChildControl.Align of + + var LChildControlAlign: TALAlignLayout; + If (LChildControl is TALControl) then LChildControlAlign := TALControl(LChildControl).Align + else LChildControlAlign := TALAlignLayout(LChildControl.Align); + + case LChildControlAlign of //-- - TAlignLayout.None: begin + TALAlignLayout.None: begin + // Adjusts AControl size to ensure it contains + // the child control at its current position. LSize.Width := Max(LSize.Width, LChildControl.Position.X + LChildControl.width + LChildControl.Margins.right + AControl.padding.right); LSize.height := Max(LSize.height, LChildControl.Position.Y + LChildControl.Height + LChildControl.Margins.bottom + AControl.padding.bottom); end; //-- - TAlignLayout.Center: begin - LSize.Width := Max(LSize.Width, LChildControl.Position.X + LChildControl.width + LChildControl.Margins.right + AControl.padding.right); - LSize.height := Max(LSize.height, LChildControl.Position.Y + LChildControl.Height + LChildControl.Margins.bottom + AControl.padding.bottom); + TALAlignLayout.Center: begin + // Adjusts AControl size to ensure it contains the + // child control without considering its current position. + // !! Note: This may not work well if there is more than + // one child control. !! + LSize.Width := Max(LSize.Width, LChildControl.Margins.left + AControl.padding.left + LChildControl.width + LChildControl.Margins.right + AControl.padding.right); + LSize.height := Max(LSize.height, LChildControl.Margins.top + AControl.padding.top + LChildControl.Height + LChildControl.Margins.bottom + AControl.padding.bottom); end; //-- - TAlignLayout.Top, - TAlignLayout.MostTop, - TAlignLayout.Bottom, - TAlignLayout.MostBottom: begin + TALAlignLayout.Top, + TALAlignLayout.MostTop, + TALAlignLayout.Bottom, + TALAlignLayout.MostBottom: begin var LAutosizeControl: IALAutosizeControl; if Supports(LChildControl, IALAutosizeControl, LAutosizeControl) and LAutosizeControl.HasUnconstrainedAutosizeX then + // If the child control has autosize enabled on the X-axis, adjusts + // AControl width to ensure it contains the child control at its + // current position. For example, TALText will never have + // HasUnconstrainedAutosizeX set to true with TALAlignLayout.Top, + // but TALLayout/TRectangle will have it set to true if their + // autosize property is enabled. LSize.Width := Max(LSize.Width, LChildControl.Position.X + LChildControl.width + LChildControl.Margins.right + AControl.padding.right) else + // Otherwise, do not adjust AControl width. LSize.Width := Max(LSize.Width, AControl.Width); + // Adjusts AControl height to ensure it contains + // the child control at its current position. + LSize.height := Max(LSize.height, LChildControl.Position.Y + LChildControl.Height + LChildControl.Margins.bottom + AControl.padding.bottom); + end; + + //-- + TALAlignLayout.TopCenter, + TALAlignLayout.TopLeft, + TALAlignLayout.TopRight, + TALAlignLayout.BottomCenter, + TALAlignLayout.BottomLeft, + TALAlignLayout.BottomRight: begin + // Adjusts AControl width to ensure it contains the + // child control without considering its current position. + // !! Note: This may not work well if there is another child control + // that is not aligned to the top or bottom. !! + LSize.Width := Max(LSize.Width, LChildControl.Margins.left + AControl.padding.left + LChildControl.width + LChildControl.Margins.right + AControl.padding.right); + // Adjusts AControl height to ensure it contains + // the child control at its current position. LSize.height := Max(LSize.height, LChildControl.Position.Y + LChildControl.Height + LChildControl.Margins.bottom + AControl.padding.bottom); end; //-- - TAlignLayout.Left, - TAlignLayout.MostLeft, - TAlignLayout.Right, - TAlignLayout.MostRight: Begin + TALAlignLayout.Left, + TALAlignLayout.MostLeft, + TALAlignLayout.Right, + TALAlignLayout.MostRight: Begin + // Adjusts AControl width to ensure it contains + // the child control at its current position. LSize.Width := Max(LSize.Width, LChildControl.Position.X + LChildControl.width + LChildControl.Margins.right + AControl.padding.right); var LAutosizeControl: IALAutosizeControl; if Supports(LChildControl, IALAutosizeControl, LAutosizeControl) and LAutosizeControl.HasUnconstrainedAutosizeY then + // If the child control has autosize enabled on the X-axis, adjusts + // AControl height to ensure it contains the child control at its + // current position. For example, TALText will never have + // HasUnconstrainedAutosizeX set to true with TALAlignLayout.Left, + // but TALLayout/TRectangle will have it set to true if their + // autosize property is enabled. LSize.height := Max(LSize.height, LChildControl.Position.Y + LChildControl.Height + LChildControl.Margins.bottom + AControl.padding.bottom) else + // Otherwise, do not adjust AControl height. LSize.height := Max(LSize.Height, AControl.Height); End; //-- - TAlignLayout.Client, - TAlignLayout.Contents, - TAlignLayout.Scale, - TAlignLayout.Fit, - TAlignLayout.FitLeft, - TAlignLayout.FitRight: Begin + TALAlignLayout.LeftCenter, + TALAlignLayout.LeftTop, + TALAlignLayout.LeftBottom, + TALAlignLayout.RightCenter, + TALAlignLayout.RightTop, + TALAlignLayout.RightBottom: begin + // Adjusts AControl width to ensure it contains + // the child control at its current position. + LSize.Width := Max(LSize.Width, LChildControl.Position.X + LChildControl.width + LChildControl.Margins.right + AControl.padding.right); + // Adjusts AControl height to ensure it contains the + // child control without considering its current position. + // !! Note: This may not work well if there is another child control + // that is not aligned to the left or right. !! + LSize.height := Max(LSize.height, LChildControl.Margins.top + AControl.padding.top + LChildControl.Height + LChildControl.Margins.bottom + AControl.padding.bottom); + end; + + //-- + TALAlignLayout.Client, + TALAlignLayout.Contents, + TALAlignLayout.Scale, + TALAlignLayout.Fit, + TALAlignLayout.FitLeft, + TALAlignLayout.FitRight: Begin var LAutosizeControl: IALAutosizeControl; if Supports(LChildControl, IALAutosizeControl, LAutosizeControl) then begin if LAutosizeControl.HasUnconstrainedAutosizeX then LSize.Width := Max(LSize.Width, LChildControl.Position.X + LChildControl.width + LChildControl.Margins.right + AControl.padding.right) @@ -5415,8 +5478,8 @@ procedure ALAutoSize(const AControl: TControl); End; //-- - TAlignLayout.Horizontal, - TAlignLayout.VertCenter: Begin + TALAlignLayout.Horizontal, + TALAlignLayout.VertCenter: Begin var LAutosizeControl: IALAutosizeControl; if Supports(LChildControl, IALAutosizeControl, LAutosizeControl) and LAutosizeControl.HasUnconstrainedAutosizeX then LSize.Width := Max(LSize.Width, LChildControl.Position.X + LChildControl.width + LChildControl.Margins.right + AControl.padding.right) @@ -5425,8 +5488,8 @@ procedure ALAutoSize(const AControl: TControl); End; //-- - TAlignLayout.Vertical, - TAlignLayout.HorzCenter: Begin + TALAlignLayout.Vertical, + TALAlignLayout.HorzCenter: Begin var LAutosizeControl: IALAutosizeControl; if Supports(LChildControl, IALAutosizeControl, LAutosizeControl) and LAutosizeControl.HasUnconstrainedAutosizeY then LSize.height := Max(LSize.height, LChildControl.Position.Y + LChildControl.Height + LChildControl.Margins.bottom + AControl.padding.bottom) diff --git a/Source/Alcinoe.FMX.Controls.pas b/Source/Alcinoe.FMX.Controls.pas index 48c9e8b6..295186d6 100644 --- a/Source/Alcinoe.FMX.Controls.pas +++ b/Source/Alcinoe.FMX.Controls.pas @@ -14,6 +14,45 @@ interface type + {**************************} + {$IFNDEF ALCompilerVersionSupported122} + {$MESSAGE WARN 'Check if FMX.Types.TAlignLayout was not updated and adjust the IFDEF'} + {$MESSAGE WARN 'Check if https://embt.atlassian.net/servicedesk/customer/portal/1/RSS-2342 was implemented and adjust the IFDEF'} + {$ENDIF} + TALAlignLayout = ( + None, + Top, + Left, + Right, + Bottom, + MostTop, + MostBottom, + MostLeft, + MostRight, + Client, + Contents, + Center, + VertCenter, + HorzCenter, + Horizontal, + Vertical, + Scale, + Fit, + FitLeft, + FitRight, + TopCenter, // Added from TAlignLayout - Works like TAlignLayout.Top, then centers the control horizontally + TopLeft, // Added from TAlignLayout - Works like TAlignLayout.Top, then aligns the control to the left. + TopRight, // Added from TAlignLayout - Works like TAlignLayout.Top, then aligns the control to the right. + LeftCenter, // Added from TAlignLayout - Works like TAlignLayout.Left, then centers the control vertically. + LeftTop, // Added from TAlignLayout - Works like TAlignLayout.Left, then aligns the control to the top. + LeftBottom, // Added from TAlignLayout - Works like TAlignLayout.Left, then aligns the control to the bottom. + RightCenter, // Added from TAlignLayout - Works like TAlignLayout.Right, then centers the control vertically. + RightTop, // Added from TAlignLayout - Works like TAlignLayout.Right, then aligns the control to the top. + RightBottom, // Added from TAlignLayout - Works like TAlignLayout.Right, then aligns the control to the bottom. + BottomCenter, // Added from TAlignLayout - Works like TAlignLayout.Bottom, then centers the control horizontally + BottomLeft, // Added from TAlignLayout - Works like TAlignLayout.Bottom, then aligns the control to the left. + BottomRight); // Added from TAlignLayout - Works like TAlignLayout.Bottom, then aligns the control to the right. + {**************************} {$IFNDEF ALCompilerVersionSupported122} {$MESSAGE WARN 'Check if FMX.Controls.TControl was not updated and adjust the IFDEF'} @@ -28,6 +67,8 @@ TALControl = class(TControl) FDisableDoubleClickHandling: Boolean; FIsPixelAlignmentEnabled: Boolean; FFormerMarginsChangedHandler: TNotifyEvent; + FAlign: TALAlignLayout; + FIsAligning: Boolean; function GetPressed: Boolean; procedure SetPressed(const AValue: Boolean); procedure DelayOnResize(Sender: TObject); @@ -54,6 +95,9 @@ TALControl = class(TControl) procedure Loaded; override; function IsOwnerLoading: Boolean; function IsSizeStored: Boolean; override; + function GetAlign: TALAlignLayout; Reintroduce; + procedure SetAlign(const Value: TALAlignLayout); Reintroduce; virtual; + procedure DoRealign; override; public constructor Create(AOwner: TComponent); override; procedure SetNewScene(AScene: IScene); override; @@ -65,7 +109,9 @@ TALControl = class(TControl) {$ENDIF} property Pressed: Boolean read GetPressed write SetPressed; procedure AlignToPixel; virtual; + procedure SetBounds(X, Y, AWidth, AHeight: Single); override; property IsPixelAlignmentEnabled: Boolean read GetIsPixelAlignmentEnabled write SetIsPixelAlignmentEnabled; + property Align: TALAlignLayout read FAlign write SetAlign default TALAlignLayout.None; end; {**************************************} @@ -175,6 +221,8 @@ constructor TALControl.Create(AOwner: TComponent); // mobile apps, leading to a more user-friendly experience. FDisableDoubleClickHandling := True; FIsPixelAlignmentEnabled := True; + FAlign := TALAlignLayout.None; + FIsAligning := False; end; {**************************} @@ -202,6 +250,131 @@ function TALControl.IsSizeStored: Boolean; (not SameValue(LDefaultSize.cy, Size.Size.cy, TEpsilon.Position)); end; +{*******************************************} +function TALControl.GetAlign: TALAlignLayout; +begin + Result := FAlign; +end; + +{*********************************************************} +procedure TALControl.SetAlign(const Value: TALAlignLayout); +begin + If FAlign <> Value then begin + FAlign := Value; + var LLegacyAlign: TAlignLayout; + Case Value of + TALAlignLayout.None: LLegacyAlign := TAlignLayout.None; + TALAlignLayout.Top: LLegacyAlign := TAlignLayout.Top; + TALAlignLayout.Left: LLegacyAlign := TAlignLayout.Left; + TALAlignLayout.Right: LLegacyAlign := TAlignLayout.Right; + TALAlignLayout.Bottom: LLegacyAlign := TAlignLayout.Bottom; + TALAlignLayout.MostTop: LLegacyAlign := TAlignLayout.MostTop; + TALAlignLayout.MostBottom: LLegacyAlign := TAlignLayout.MostBottom; + TALAlignLayout.MostLeft: LLegacyAlign := TAlignLayout.MostLeft; + TALAlignLayout.MostRight: LLegacyAlign := TAlignLayout.MostRight; + TALAlignLayout.Client: LLegacyAlign := TAlignLayout.Client; + TALAlignLayout.Contents: LLegacyAlign := TAlignLayout.Contents; + TALAlignLayout.Center: LLegacyAlign := TAlignLayout.Center; + TALAlignLayout.VertCenter: LLegacyAlign := TAlignLayout.VertCenter; + TALAlignLayout.HorzCenter: LLegacyAlign := TAlignLayout.HorzCenter; + TALAlignLayout.Horizontal: LLegacyAlign := TAlignLayout.Horizontal; + TALAlignLayout.Vertical: LLegacyAlign := TAlignLayout.Vertical; + TALAlignLayout.Scale: LLegacyAlign := TAlignLayout.Scale; + TALAlignLayout.Fit: LLegacyAlign := TAlignLayout.Fit; + TALAlignLayout.FitLeft: LLegacyAlign := TAlignLayout.FitLeft; + TALAlignLayout.FitRight: LLegacyAlign := TAlignLayout.FitRight; + TALAlignLayout.TopCenter: LLegacyAlign := TAlignLayout.Top; + TALAlignLayout.TopLeft: LLegacyAlign := TAlignLayout.Top; + TALAlignLayout.TopRight: LLegacyAlign := TAlignLayout.Top; + TALAlignLayout.LeftCenter: LLegacyAlign := TAlignLayout.Left; + TALAlignLayout.LeftTop: LLegacyAlign := TAlignLayout.Left; + TALAlignLayout.LeftBottom: LLegacyAlign := TAlignLayout.Left; + TALAlignLayout.RightCenter: LLegacyAlign := TAlignLayout.Right; + TALAlignLayout.RightTop: LLegacyAlign := TAlignLayout.Right; + TALAlignLayout.RightBottom: LLegacyAlign := TAlignLayout.Right; + TALAlignLayout.BottomCenter: LLegacyAlign := TAlignLayout.Bottom; + TALAlignLayout.BottomLeft: LLegacyAlign := TAlignLayout.Bottom; + TALAlignLayout.BottomRight: LLegacyAlign := TAlignLayout.Bottom; + else Raise Exception.Create('Error D527A470-23AC-4E3C-BCC5-4C2DB578A691'); + end; + Inherited SetAlign(LLegacyAlign); + end; +end; + +{*****************************} +procedure TALControl.DoRealign; +begin + if not FNeedAlign then + Exit; + {$IFNDEF ALCompilerVersionSupported122} + {$MESSAGE WARN 'Check if https://quality.embarcadero.com/browse/RSP-15768 was implemented and adjust the IFDEF'} + {$ENDIF} + var LOriginalSize: TPointF := Size.Size; // https://quality.embarcadero.com/browse/RSP-15768 + FIsAligning := True; + Try + inherited; + finally + FIsAligning := False; + end; + if not LOriginalSize.EqualsTo(Size.Size) then DoRealign; // https://quality.embarcadero.com/browse/RSP-15768 +end; + +{************************************************************} +procedure TALControl.SetBounds(X, Y, AWidth, AHeight: Single); +begin + {$IFNDEF ALCompilerVersionSupported122} + {$MESSAGE WARN 'Check if https://embt.atlassian.net/servicedesk/customer/portal/1/RSS-2342 was implemented and adjust the IFDEF'} + {$ENDIF} + If (FAlign in [TALAlignLayout.TopCenter, + TALAlignLayout.TopLeft, + TALAlignLayout.TopRight, + TALAlignLayout.LeftCenter, + TALAlignLayout.LeftTop, + TALAlignLayout.LeftBottom, + TALAlignLayout.RightCenter, + TALAlignLayout.RightTop, + TALAlignLayout.RightBottom, + TALAlignLayout.BottomCenter, + TALAlignLayout.BottomLeft, + TALAlignLayout.BottomRight]) and + (ParentControl is TALControl) and + (TALControl(ParentControl).FIsAligning) then begin + case FAlign of + TALAlignLayout.TopCenter, + TALAlignLayout.BottomCenter: begin + X := X + ((AWidth - Width) / 2); + AWidth := Width; + end; + TALAlignLayout.TopLeft, + TALAlignLayout.BottomLeft: begin + AWidth := Width; + end; + TALAlignLayout.TopRight, + TALAlignLayout.BottomRight: begin + X := X + (AWidth - Width); + AWidth := Width; + end; + TALAlignLayout.LeftCenter, + TALAlignLayout.RightCenter: begin + Y := Y + ((AHeight - Height) / 2); + AHeight := Height; + end; + TALAlignLayout.LeftTop, + TALAlignLayout.RightTop: begin + AHeight := Height; + end; + TALAlignLayout.LeftBottom, + TALAlignLayout.RightBottom: begin + Y := Y + (AHeight - Height); + AHeight := Height; + end; + else + raise Exception.Create('Error 9431A388-3F2F-4F06-8296-210708F60C66'); + end; + end; + inherited; +end; + {********************************} procedure TALControl.AlignToPixel; begin @@ -220,32 +393,44 @@ procedure TALControl.AlignToPixel; Margins.Rect := ALAlignEdgesToPixelRound(Margins.Rect, ALGetScreenScale, TEpsilon.Position); Padding.Rect := ALAlignEdgesToPixelRound(Padding.Rect, ALGetScreenScale, TEpsilon.Position); case Align of - TAlignLayout.None, - TAlignLayout.Center: + TALAlignLayout.None, + TALAlignLayout.Center, + TALAlignLayout.TopCenter, + TALAlignLayout.TopLeft, + TALAlignLayout.TopRight, + TALAlignLayout.LeftCenter, + TALAlignLayout.LeftTop, + TALAlignLayout.LeftBottom, + TALAlignLayout.RightCenter, + TALAlignLayout.RightTop, + TALAlignLayout.RightBottom, + TALAlignLayout.BottomCenter, + TALAlignLayout.BottomLeft, + TALAlignLayout.BottomRight: Size.Size := ALAlignDimensionToPixelRound(Size.Size, ALGetScreenScale, TEpsilon.Position); //-- - TAlignLayout.Top, - TAlignLayout.MostTop, - TAlignLayout.Bottom, - TAlignLayout.MostBottom, - TAlignLayout.Horizontal, - TAlignLayout.VertCenter: + TALAlignLayout.Top, + TALAlignLayout.MostTop, + TALAlignLayout.Bottom, + TALAlignLayout.MostBottom, + TALAlignLayout.Horizontal, + TALAlignLayout.VertCenter: Size.Height := ALAlignDimensionToPixelRound(Size.Height , ALGetScreenScale, TEpsilon.Position); //-- - TAlignLayout.Left, - TAlignLayout.MostLeft, - TAlignLayout.Right, - TAlignLayout.MostRight, - TAlignLayout.Vertical, - TAlignLayout.HorzCenter: + TALAlignLayout.Left, + TALAlignLayout.MostLeft, + TALAlignLayout.Right, + TALAlignLayout.MostRight, + TALAlignLayout.Vertical, + TALAlignLayout.HorzCenter: Size.Width := ALAlignDimensionToPixelRound(Size.Width , ALGetScreenScale, TEpsilon.Position); //-- - TAlignLayout.Client, - TAlignLayout.Contents, - TAlignLayout.Scale, - TAlignLayout.Fit, - TAlignLayout.FitLeft, - TAlignLayout.FitRight:; + TALAlignLayout.Client, + TALAlignLayout.Contents, + TALAlignLayout.Scale, + TALAlignLayout.Fit, + TALAlignLayout.FitLeft, + TALAlignLayout.FitRight:; //-- else Raise Exception.Create('Error AC54DF90-F880-4BD5-8474-E62BD8D099FB') diff --git a/Source/Alcinoe.FMX.Edit.pas b/Source/Alcinoe.FMX.Edit.pas index e1516ba7..39545f0f 100644 --- a/Source/Alcinoe.FMX.Edit.pas +++ b/Source/Alcinoe.FMX.Edit.pas @@ -4408,7 +4408,7 @@ procedure TALBaseEdit.InitEditControl; FeditControl.SetSubComponent(True); FeditControl.Locked := True; FeditControl.OnReturnKey := nil; // noops operation - fEditControl.Align := TAlignLayout.Client; + fEditControl.Align := TALAlignLayout.Client; FeditControl.OnChange := OnChangeImpl; fEditControl.Password := false; // noops operation fEditControl.ReturnKeyType := tReturnKeyType.Default; // noops operation @@ -6330,14 +6330,14 @@ function TALEdit.HasUnconstrainedAutosizeX: Boolean; function TALEdit.HasUnconstrainedAutosizeY: Boolean; begin result := (GetAutoSize) and - (not (Align in [TAlignLayout.Client, - TAlignLayout.Contents, - TAlignLayout.Left, - TAlignLayout.Right, - TAlignLayout.MostLeft, - TAlignLayout.MostRight, - TAlignLayout.Vertical, - TAlignLayout.HorzCenter])) + (not (Align in [TALAlignLayout.Client, + TALAlignLayout.Contents, + TALAlignLayout.Left, + TALAlignLayout.Right, + TALAlignLayout.MostLeft, + TALAlignLayout.MostRight, + TALAlignLayout.Vertical, + TALAlignLayout.HorzCenter])) end; {**************************************************} diff --git a/Source/Alcinoe.FMX.Memo.pas b/Source/Alcinoe.FMX.Memo.pas index 16e3df73..cd4837fe 100644 --- a/Source/Alcinoe.FMX.Memo.pas +++ b/Source/Alcinoe.FMX.Memo.pas @@ -387,6 +387,7 @@ implementation DesignIntf, {$ENDIF} Alcinoe.FMX.Graphics, + Alcinoe.FMX.Controls, Alcinoe.Common; {$REGION ' Android'} @@ -1657,14 +1658,14 @@ function TALMemo.HasUnconstrainedAutosizeX: Boolean; function TALMemo.HasUnconstrainedAutosizeY: Boolean; begin result := (FAutoSizeLineCount > 0) and - (not (Align in [TAlignLayout.Client, - TAlignLayout.Contents, - TAlignLayout.Left, - TAlignLayout.Right, - TAlignLayout.MostLeft, - TAlignLayout.MostRight, - TAlignLayout.Vertical, - TAlignLayout.HorzCenter])); + (not (Align in [TALAlignLayout.Client, + TALAlignLayout.Contents, + TALAlignLayout.Left, + TALAlignLayout.Right, + TALAlignLayout.MostLeft, + TALAlignLayout.MostRight, + TALAlignLayout.Vertical, + TALAlignLayout.HorzCenter])); end; {**************************************} diff --git a/Source/Alcinoe.FMX.Objects.pas b/Source/Alcinoe.FMX.Objects.pas index c475e781..619f779a 100644 --- a/Source/Alcinoe.FMX.Objects.pas +++ b/Source/Alcinoe.FMX.Objects.pas @@ -705,7 +705,7 @@ TALBaseText = class(TALShape, IALAutosizeControl, IALDoubleBufferedControl) FIsAdjustingSize: Boolean; function GetDoubleBuffered: boolean; procedure SetDoubleBuffered(const AValue: Boolean); - procedure SetAlign(const Value: TAlignLayout); override; + procedure SetAlign(const Value: TALAlignLayout); override; function GetAutoSize: Boolean; virtual; procedure SetAutoSize(const Value: Boolean); virtual; function GetElementAtPos(const APos: TPointF): TALTextElement; @@ -3292,8 +3292,8 @@ procedure TALBaseText.SetDoubleBuffered(const AValue: Boolean); end; end; -{********************************************************} -procedure TALBaseText.SetAlign(const Value: TAlignLayout); +{**********************************************************} +procedure TALBaseText.SetAlign(const Value: TALAlignLayout); begin if Align <> Value then clearBufDrawable; inherited SetAlign(Value); @@ -3309,28 +3309,28 @@ function TALBaseText.GetAutoSize: Boolean; function TALBaseText.HasUnconstrainedAutosizeX: Boolean; begin Result := (GetAutoSize) and - (not (Align in [TAlignLayout.Client, - TAlignLayout.Contents, - TAlignLayout.Top, - TAlignLayout.Bottom, - TAlignLayout.MostTop, - TAlignLayout.MostBottom, - TAlignLayout.Horizontal, - TAlignLayout.VertCenter])); + (not (Align in [TALAlignLayout.Client, + TALAlignLayout.Contents, + TALAlignLayout.Top, + TALAlignLayout.Bottom, + TALAlignLayout.MostTop, + TALAlignLayout.MostBottom, + TALAlignLayout.Horizontal, + TALAlignLayout.VertCenter])); end; {******************************************************} function TALBaseText.HasUnconstrainedAutosizeY: Boolean; begin Result := (GetAutoSize) and - (not (Align in [TAlignLayout.Client, - TAlignLayout.Contents, - TAlignLayout.Left, - TAlignLayout.Right, - TAlignLayout.MostLeft, - TAlignLayout.MostRight, - TAlignLayout.Vertical, - TAlignLayout.HorzCenter])); + (not (Align in [TALAlignLayout.Client, + TALAlignLayout.Contents, + TALAlignLayout.Left, + TALAlignLayout.Right, + TALAlignLayout.MostLeft, + TALAlignLayout.MostRight, + TALAlignLayout.Vertical, + TALAlignLayout.HorzCenter])); end; {******************************************************} diff --git a/Source/Alcinoe.FMX.StdCtrls.pas b/Source/Alcinoe.FMX.StdCtrls.pas index cc399159..d0574b60 100644 --- a/Source/Alcinoe.FMX.StdCtrls.pas +++ b/Source/Alcinoe.FMX.StdCtrls.pas @@ -4459,8 +4459,8 @@ function TALCustomTrack.CreateInactiveTrack(const AInactiveTrackClass: TInactive Result.Margins.Rect := Result.Margins.DefaultValue; Result.Margins.OnChange := LMarginsChange; //-- - if Orientation = TOrientation.Horizontal then Result.Align := TalignLayout.vertical - else Result.Align := TalignLayout.horizontal; + if Orientation = TOrientation.Horizontal then Result.Align := TALAlignLayout.vertical + else Result.Align := TALAlignLayout.horizontal; end; {*********************************************************************************************************************************************} @@ -4481,8 +4481,8 @@ function TALCustomTrack.CreateActiveTrack(const AActiveTrackClass: TActiveTrackC Result.Margins.Rect := Result.Margins.DefaultValue; Result.Margins.OnChange := LMarginsChange; //-- - if Orientation = TOrientation.Horizontal then Result.Align := TalignLayout.vertical - else Result.Align := TalignLayout.horizontal; + if Orientation = TOrientation.Horizontal then Result.Align := TALAlignLayout.vertical + else Result.Align := TALAlignLayout.horizontal; end; {***************************************************************************************************************} @@ -4497,8 +4497,8 @@ function TALCustomTrack.CreateThumb(const AThumbClass: TThumbClass = nil; Const Result.Name := AName; // Useful at design time in the IDE Result.Width := GetDefaultSize.Height; // 32 px width //-- - if Orientation = TOrientation.Horizontal then Result.Align := TalignLayout.vertical - else Result.Align := TalignLayout.horizontal; + if Orientation = TOrientation.Horizontal then Result.Align := TALAlignLayout.vertical + else Result.Align := TALAlignLayout.horizontal; end; {************************************************************************************************************************************************************} @@ -4824,11 +4824,11 @@ procedure TALCustomTrack.SetOrientation(const Value: TOrientation); Result.Bottom := ARect.Right; End; - {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} - function SwapAlign(Const AAlign: TalignLayout): TalignLayout; + {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} + function SwapAlign(Const AAlign: TALAlignLayout): TALAlignLayout; Begin - If AAlign = TalignLayout.Vertical then result := TalignLayout.Horizontal - else If AAlign = TalignLayout.Horizontal then result := TalignLayout.Vertical + If AAlign = TALAlignLayout.Vertical then result := TALAlignLayout.Horizontal + else If AAlign = TALAlignLayout.Horizontal then result := TALAlignLayout.Vertical else result := AAlign; End; @@ -5422,11 +5422,11 @@ procedure TALRangeTrackBar.SetOrientation(const Value: TOrientation); Result.Bottom := ARect.Right; End; - {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} - function SwapAlign(Const AAlign: TalignLayout): TalignLayout; + {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} + function SwapAlign(Const AAlign: TALAlignLayout): TALAlignLayout; Begin - If AAlign = TalignLayout.Vertical then result := TalignLayout.Horizontal - else If AAlign = TalignLayout.Horizontal then result := TalignLayout.Vertical + If AAlign = TALAlignLayout.Vertical then result := TALAlignLayout.Horizontal + else If AAlign = TALAlignLayout.Horizontal then result := TALAlignLayout.Vertical else result := AAlign; End; @@ -8326,7 +8326,7 @@ procedure TALSwitch.TThumb.TThumbStateStyles.TransitionAnimationProcess(Sender: begin var LThumb := Parent; var LSwitch := TALSwitch(LThumb.ParentControl{Track}.ParentControl{Switch}); - if (not LSwitch.Pressed) and (Lthumb.Align = TAlignLayout.None) then begin + if (not LSwitch.Pressed) and (Lthumb.Align = TALAlignLayout.None) then begin var LFloatAnimation := TALFloatAnimation(Sender); var LStopPositionX: Single; If LSwitch.Checked then LStopPositionX := LSwitch.GetMaxThumbPos @@ -8419,7 +8419,7 @@ constructor TALSwitch.Create(AOwner: TComponent); FTrack.Stored := False; FTrack.SetSubComponent(True); FTrack.Name := 'Track'; // Useful at design time in the IDE - FTrack.Align := TalignLayout.Client; + FTrack.Align := TALAlignLayout.Client; //-- // Use 'self' instead of 'FTrack' to ensure that // 'Fthumb.loaded' is called. @@ -8569,7 +8569,7 @@ procedure TALSwitch.MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Si begin inherited; if Pressed then begin - fThumb.Align := TALignLayout.None; + fThumb.Align := TALALignLayout.None; FPressedThumbPos := FThumb.Position.Point; end; end; @@ -8617,7 +8617,7 @@ procedure TALSwitch.MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Sing if not Thumb.StateStyles.TransitionClickDelayed then DoChange; end; - fThumb.Align := TALignLayout.None; + fThumb.Align := TALALignLayout.None; StartTransition; end; end; @@ -8640,7 +8640,7 @@ procedure TALSwitch.DoMouseLeave; if not Thumb.StateStyles.TransitionClickDelayed then DoChange; end; - fThumb.Align := TALignLayout.None; + fThumb.Align := TALALignLayout.None; StartTransition; end; end; @@ -8659,7 +8659,7 @@ procedure TALSwitch.Click; var LChecked := not Checked; FTrack.Checked := LChecked; FThumb.Checked := LChecked; - fThumb.Align := TALignLayout.None; + fThumb.Align := TALALignLayout.None; StartTransition; exit; end @@ -8668,7 +8668,7 @@ procedure TALSwitch.Click; var LChecked := not Checked; FTrack.Checked := LChecked; FThumb.Checked := LChecked; - fThumb.Align := TALignLayout.None; + fThumb.Align := TALALignLayout.None; DoChange; inherited; StartTransition; @@ -8718,8 +8718,8 @@ procedure TALSwitch.AlignThumb; begin If CsLoading in ComponentState then Exit; if pressed or fScrollCapturedByMe then exit; - If Checked then FThumb.Align := TALignLayout.right - else FThumb.Align := TALignLayout.left; + If Checked then FThumb.Align := TALAlignLayout.right + else FThumb.Align := TALAlignLayout.left; end; {*************************************}