Search code examples
gridfiremonkeyregister-transfer-level

How to use right to left languages in fmx grids


What is the best way in FMX to create a grid that supports bidimode and righttoleft languages I have tried fmxrtl but it has many errors Thanks


Solution

  • Is your app only for Windows ? If yes, I use a function to detect if it's a Bidi string and then use TTextLayout my test here Else, try to use SKIA4Delphi (XE7+)Supporting right to left

    I test an Android little app ScreenShot

    procedure TForm1.Grid1DrawColumnCell(Sender: TObject; const Canvas: TCanvas;
      const Column: TColumn; const Bounds: TRectF; const Row: Integer;
      const Value: TValue; const State: TGridDrawStates);
    begin
    if (Column.Index=1) AND (Row>=1)
    then begin
          Canvas.Fill.Color:=TAlphaColors.Red;
          Canvas.FillText(Bounds,Value.ToString,false,1,[TFillTextFlag.RightToLeft],TTextAlign.Leading);
    end
    else Column.DefaultDrawCell(Canvas,bounds,row,value,state);
    end;