سلام با تشکر از دوست خیلی خوبم Mkarimpour که زحمت این تابع فوق العاده رو کشیده من یه کاری کردم البته شاید به ذهن بقیه هم رسیده باشه اما گفتم سهم کوچیکی داشته باشم. با این تابع میتونید در حال تایپ کردن فارسی رو درست نمایش بدبد. البته دارم سعی می کنم کامپوننت کنمش اما Edit یه سری محدودیت داره تو کلاس هاش که دارم سعی می کنم درستش کنم.

unit DPAEdit;

interface

uses
System.SysUtils, System.Classes, FMX.Types, FMX.Controls,
FMX.Controls.Presentation, FMX.Edit, StrUtils;

type
TDPAEdit = class(TEdit)
private
FBeforChars: String;
FSpaceKeyPressed: Boolean;
protected
procedure SetOnTyping;
procedure SetOnValidate;
published
Property SpaceKeyPressed : Boolean Read FSpaceKeyPressed Write FSpaceKeyPressed;
end;

procedure Register;

implementation

uses FarsiReshaper;

procedure Register;
begin
RegisterComponents('Standard', [TDPAEdit]);
end;

{ TDPAEdit }

{constructor TDPAEdit.Create;
begin
inherited;
FSpaceKeyPressed := False;
end; }

procedure TDPAEdit.SetOnTyping;
var
RealBefore,
LastChar: String;
begin
inherited;
LastChar := Copy(Text.Trim, Text.Trim.Length, 1);
RealBefore := ReverseString(TFarsi.ConvertBackToRealFarsi(FBefor Chars)).TrimLeft;

if Text.Trim.Length > RealBefore.Trim.Length Then
Begin
if FSpaceKeyPressed then
Begin
Text := TFarsi.Convert(RealBefore + ' ' + LastChar);
FSpaceKeyPressed := False;
End
Else
Text := TFarsi.Convert(RealBefore + LastChar);
End
Else if RealBefore.Trim.Length = Text.Trim.Length Then
FSpaceKeyPressed := True
Else if Text.Trim.Length < RealBefore.Trim.Length Then
Text := TFarsi.Convert(Copy(RealBefore, 1, RealBefore.Length - 1));
end;

procedure TDPAEdit.SetOnValidate;
begin
inherited;
FBeforChars := Text;
end;

end.