Recent

Author Topic: Arabic language issues  (Read 13079 times)

Avishai

  • Hero Member
  • *****
  • Posts: 1021
Re: Arabic language issues
« Reply #15 on: December 07, 2012, 11:57:42 am »
For Window ONLY!  This code will mirror most TWinControls including TForm and make them function RightToLeft.  It solves many problems, but not all of them.  You should leave BiDiMode:= bdLeftToRight.  You should call RtlCtrl for each TWinControl.  You need to include 'Windows' in the Uses statement.

A few of the known issues:
TMenu/TPopupMenu Images, TBitBtn, TSpeedButton Images, TSynEdit, TButtonPanel...

Edit:  I forgot to say that you MUST disable Themes for this to work.  Go to 'Project\Project Options' and UNCHECK 'Use manifest...'  If you do not then TWinControls that are RightToLeft will be Black and not usable.

Code: [Select]

uses Windows;

const
  RightToLeftLayout = $400000;
  NoInheritLayout = $00100000;

{===== RtlCtrl =====}

procedure RtlCtrl(ACtrl: TObject);
{ Make TWinControl RightToLeft - Windows ONLY! }
begin
{$IfDef Windows}
  if ACtrl is TWinControl then
    with TWinControl(ACtrl) do begin
      SetWindowLong(Handle, GWL_EXSTYLE, GetWindowLong(Handle, GWL_EXSTYLE)
        or RightToLeftLayout or NoInheritLayout);
  end;
{$EndIf}
end;

{===== LtrCtrl =====}

procedure LtrCtrl(ACtrl: TObject);
{ Make TWinControl LeftToRight - Windows ONLY! }
begin
{$IfDef Windows}
  if ACtrl is TWinControl then
    with ACtrl as TWinControl do begin
      SetWindowLong(Handle, GWL_EXSTYLE, GetWindowLong(Handle, GWL_EXSTYLE)
        and RightToLeftLayout and NoInheritLayout);
  end;
{$EndIf}
end;
« Last Edit: December 07, 2012, 04:51:18 pm by Avishai »
Lazarus Trunk / fpc 2.6.2 / Win32

vicot

  • Full Member
  • ***
  • Posts: 114
Re: Arabic language issues
« Reply #16 on: December 27, 2012, 10:03:12 pm »
I would like to know a couple of things:

1) which GUI toolkit supported by Lazarus do you recommend for Arabic and BiDi?

2) does it support writing Arabic text and English text on the same line?

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9874
  • Debugger - SynEdit - and more
    • wiki
Re: Arabic language issues
« Reply #17 on: December 28, 2012, 11:34:24 pm »
As for the source-editor/SynEdit.

Under Windows (currently only windows) you can define WithSynExperimentalCharWidth and recompile the IDE/SynEdit. Then you should be able to type mixed RTL/LTR

 

TinyPortal © 2005-2018