Created
August 21, 2016 23:29
Star
You must be signed in to star a gist
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