diff --git a/lcl/forms.pp b/lcl/forms.pp index 95ed13d367..40d2b79576 100644 --- a/lcl/forms.pp +++ b/lcl/forms.pp @@ -1375,6 +1375,9 @@ type procedure IntfAppRestore; procedure IntfDropFiles(const FileNames: Array of String); procedure IntfThemeOptionChange(AThemeServices: TThemeServices; AOption: TThemeOption); + + function IsRTLLang(ALang: String): Boolean; + function Direction(ALang: String): TBiDiMode; public procedure DoArrowKey(AControl: TWinControl; var Key: Word; Shift: TShiftState); diff --git a/lcl/include/application.inc b/lcl/include/application.inc index daf658c7e9..3bc68d30e2 100644 --- a/lcl/include/application.inc +++ b/lcl/include/application.inc @@ -85,15 +85,6 @@ end; TApplication Constructor ------------------------------------------------------------------------------} constructor TApplication.Create(AOwner: TComponent); -const - BidiModeMap: array[Boolean] of TBiDiMode = (bdLeftToRight, bdRightToLeft); - - function IsRTLLang(ALang: String): Boolean; - begin - Result := (ALang = 'ar') or - (ALang = 'he'); - end; - var LangDefault, LangFallback: String; begin @@ -128,9 +119,9 @@ begin {$ifndef wince}// remove ifdef when gettext is fixed LCLGetLanguageIDs(LangDefault, LangFallback); if LangDefault <> '' then - FBidiMode := BidiModeMap[IsRTLLang(LangDefault)] + FBidiMode := Direction(LangDefault) else - FBidiMode := BidiModeMap[IsRTLLang(LangFallback)]; + FBidiMode := Direction(LangFallback); {$else} FBidiMode := bdLeftToRight; {$endif} @@ -2228,3 +2219,17 @@ begin Result := False; if Assigned(FOnActionUpdate) then FOnActionUpdate(TheAction, Result); end; + +function TApplication.IsRTLLang(ALang: String): Boolean; +begin + Result := (LowerCase(ALang) = 'ar') or + (LowerCase(ALang) = 'he'); +end; + +function TApplication.Direction(ALang: String): TBiDiMode; +const + BidiModeMap: array[Boolean] of TBiDiMode = (bdLeftToRight, bdRightToLeft); +begin + Result := BidiModeMap[IsRTLLang(ALang)]; +end; + diff --git a/lcl/include/customform.inc b/lcl/include/customform.inc index 11592e3bbf..0541a979ea 100644 --- a/lcl/include/customform.inc +++ b/lcl/include/customform.inc @@ -1905,6 +1905,10 @@ begin FloatingDockSiteClass := TWinControlClass(ClassType); Screen.AddForm(Self); FAllowDropFiles := False; + + if ParentBiDiMode then + BiDiMode := Application.BidiMode; + // the EndFormUpdate is done in AfterConstruction end;