In Delphi (D6) if you set "BiDiMode:= bdRightToLeft" on some Edit Controls, and "BiDiMode:= bdLeftToRight" on other controls and add the following code, Entering an Edit Control will automatically load the correct keyboard language for each control. You can override the language manually when needed.
--------------
const
LangHeb = $40D;
initialization
with Application do begin
NonBiDiKeyboard:= IntToHex(GetUserDefaultLangId,8);
BiDiKeyboard:= IntToHex(LangHeb,8);
SysLocale.MiddleEast:= True;
end;
--------------
I am trying to find an elegant way to do this in Lazarus (Windows only). I have tried "ActivateKeyboardLayout" in the "OnEnter" event of each control and it works, but it is a long way from the elegance and ease of Delphi. I also tried setting "TForm.KeyPreview:= True" and loading the language according to "TForm.ActiveControl.BiDiMode" in the "OnKeyUp" event of TForm, but this does not allow the user to override manually.
If anyone has some ideas, I would like to hear them. I would be glad to share any BiDi code that I have with anyone working with Right To Left languages.