Recent

Author Topic: (Solved) Problem with TpageControl BiDiMode  (Read 3189 times)

delphi887

  • New Member
  • *
  • Posts: 30
    • my personal website
(Solved) Problem with TpageControl BiDiMode
« on: March 06, 2013, 08:53:04 am »
hi  :)
i programing with Lazarus in Linux and Windows.
my program language is Persian and BiDiMode in Tform and othe component  change to  bdRightToLeft .
in Kubuntu or ubunru Tpagecontrol set right to left  correctly but in windows XP not correct.
my program in Kubutnu with Tpagecontrol BiDiMode bdRightToLeft
http://ubuntuone.com/4B5p8hgaOovvHQ8cgrdQpz

my program in Windows XP with Tpagecontrol BiDiMode bdRightToLeft
http://ubuntuone.com/7dM65nPUCkvCYZPhZ2tDnY

How do I fix this error in Windows XP ????  %)
« Last Edit: March 06, 2013, 07:31:47 pm by delphi887 »

theo

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1931

Avishai

  • Hero Member
  • *****
  • Posts: 1021
Re: Problem with TpageControl BiDiMode
« Reply #2 on: March 06, 2013, 04:49:19 pm »
I have made a lot of progress in recent times.  The Following routines should help mirror TWinControls (Like TPageControl) for RightToLeft or LeftToRight under MSWindows. But you MUST disable Themes for this to work.  I ask that if you find better solutions you let me know.  Good Luck.

Code: [Select]
{===== RtlCtrl =====}

procedure RTLCtrl(ACtrl: TObject);
{ Make TWinControl RightToLeft - MSWindows ONLY! }
begin
{$IfDef MSWindows}
  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 MSWindows}
  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;
Lazarus Trunk / fpc 2.6.2 / Win32

delphi887

  • New Member
  • *
  • Posts: 30
    • my personal website
Re: Problem with TpageControl BiDiMode
« Reply #3 on: March 06, 2013, 07:30:25 pm »
hi  :)
thanks very much theo & Avishai  ;)
this solution is worked and  TPageControl set RightToLeft  completely.
only  Themes  is disabled  :(  :'(
good luck  ;)

Avishai

  • Hero Member
  • *****
  • Posts: 1021
Re: (Solved) Problem with TpageControl BiDiMode
« Reply #4 on: March 06, 2013, 07:39:41 pm »
Hopefully someday soon someone will figure out how to fix Themes so that we can do RightToLeft with Themes on.  By the way, you can even mirror TFrom the way it should be.  Those routines work on all TWinControls, but some controls don't like it.  For example SynEdit, but why would anyone mirror SynEdit???
Lazarus Trunk / fpc 2.6.2 / Win32

 

TinyPortal © 2005-2018