I'm using Delphi Seattle and my application is for Windows Desktop.
I'm trying to change the font size of a TEdit. Consequently the height was also modified. At design time everything works well, but when I run my application TEdit ignores the height modification and the text is cut.
I've tried to find FixedHeight
as suggested here, but I couldn't find this property.
Is it possible to change TEdit Heigth?
This can be solved by overriding the control’s AdjustFixedSize
method.
As explained by @chrisrolliston, Removing a FMX control’s size restrictions and exemplified here:
unit Unit4;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.Edit, MyTEdit;
type
TForm4 = class(TForm)
Edit1: TEdit;
procedure FormCreate(Sender: TObject);
end;
var
Form4: TForm4;
implementation
{$R *.fmx}
procedure TForm4.FormCreate(Sender: TObject);
begin
Edit1.Height := 60;
end;
end.
unit MyTEdit;
interface
uses
FMX.Edit, FMX.Controls;
type
TEdit = class(FMX.Edit.TEdit)
protected
procedure AdjustFixedSize(const Ref: TControl); override;
end;
implementation
uses
FMX.Types;
procedure TEdit.AdjustFixedSize(const Ref: TControl);
begin
SetAdjustType(TAdjustType.None);
end;
end.
If your're using styles in StyleBook:
editstyle
for Editbox. You should search this name in styles.editstyle
in a list of styles.FixedHeight
to 0. Also you can set Align = None
to reset align height. If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With