Created
August 21, 2016 23:29
-
-
Save ortuagustin/aa823d6a1f4ff6c36d59e67c36488b89 to your computer and use it in GitHub Desktop.
Firemonkey constraint
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Source: http://delphiaccess.com/foros/index.php/topic/12206-alguien-conoce-algo-análogo-a-constraint-de-vcl/ | |
// Author: @genriquez | |
unit FMX.Layout.Constraint; | |
type | |
TLayout = class(FMX.Layouts.TLayout) | |
private | |
FConstraint: TPoint; | |
procedure SetConstraint(const Value: TPoint); | |
protected | |
procedure HandleSizeChanged; Override; | |
public | |
Property Constraint: TPoint read FConstraint write SetConstraint; | |
end; | |
implementation | |
{ TLayout } | |
procedure TLayout.HandleSizeChanged; | |
begin | |
If (FConstraint.X > 0) and (Width < FConstraint.X) then | |
Width := FConstraint.X; | |
If (FConstraint.Y > 0) and (Height < FConstraint.Y) then | |
Height := FConstraint.Y; | |
inherited; | |
end; | |
procedure TLayout.SetConstraint(const Value: TPoint); | |
begin | |
FConstraint := Value; | |
end; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment