Programming => Widgetset => Win32/64 => Topic started by: LazProgger on April 13, 2021, 09:44:28 pm

Title: BidiMode versus Caption, Icon and SystemMenu of Form
Post by: LazProgger 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?
TinyPortal © 2005-2018