Author Topic: BidiMode versus Caption, Icon and SystemMenu of Form  (Read 700 times)


  • Jr. Member
  • **
  • Posts: 92
BidiMode versus Caption, Icon and SystemMenu of Form
« on: April 13, 2021, 09:44:28 pm »
I want to create an application that supports right to left mode (RTL) on Windows.

When setting the BidiMode of the Form...

Code: Pascal  [Select][+][-]
  1. Form1.BiDiMode := bdRightToLeft;

...the font caption appears on the right (correct) but the icon of the form as well as the system menu of the form are not switching (incorrect).

I have searched the forum and found the following code:

Code: Pascal  [Select][+][-]
  1. const
  2.   RightToLeftLayout = $400000;
  3.   NoInheritLayout = $00100000;  
  5. procedure LTRCtrl(ACtrl: TObject);
  6. begin
  7.   if ACtrl is TWinControl then
  8.     with ACtrl as TWinControl do begin
  9.       SetWindowLong(Handle, GWL_EXSTYLE, GetWindowLong(Handle, GWL_EXSTYLE)
  10.                     and RightToLeftLayout and NoInheritLayout);
  11.   end;
  12. end;

With LTRCtrl(Form1), the icon of the form and the system menu are switching (correct) but the caption remains at the left (incorrect) - so just the other way around.

Then I tried to call both after each other but it seems as if one is revoking the other - the icon and system menu was correct with this but the caption remains left (side effect: the text of labels appeared mirrored).

Does someone know how to implement this correctly?
« Last Edit: April 13, 2021, 09:49:11 pm by LazProgger »


TinyPortal © 2005-2018