I have a very basic problem and I can't figure out why. I want to select the text of a TEdit when the field receives focus. In Delphi 7 with VCL you can do this in the OnEnter event:
TEdit(Sender).SelLength := Length(TEdit(Sender).Text)
Now, with Delphi 10.2 and FireMonkey, I've tried it in several different ways, but it doesn't work.
Example:
procedure TfPrincipal.Edit1Enter(Sender: TObject);
begin
TEdit(Sender).SetFocus;
TEdit(Sender).SelStart := 0; // I already tried to change this value
TEdit(Sender).SelLength := Length(TEdit(Sender).Text); // I already tried to change this value too
end;
Edit1.SelectAll
procedure also doesn't work. – wBBOnClick
event, but not inOnEnter
like in VCL. Thank you again @Victoria – wBBVcl TEdit
, while this question is about theFmx TEdit
, so, not a duplicate. – Tom Brunberg