Hello,
I'm trying to make a Form that is a true RightToLeft Form. I have the following code that only works up to a point. It does mirror the Form, but for some reason the Form Client area is Black and I can't change it. Also the Form Caption ends up on the Left side when it should be on the Right. The only "solution" I have found so far is to put a TPanel on the Form and set it's Align property to alClient and make it the Parent of all other controls. That "fixes" the color problem, but it doesn't help with the Form Caption alignment. If anyone can help with these two points, I would be very much appreciative.
procedure TForm1.FormCreate(Sender: TObject);
{Make Form RightToLeft}
const
Frm_FIRST = $1000;
Frm_GETHEADER = Frm_FIRST + 31;
var
header: thandle;
begin
header:= SendMessage (Form1.Handle, Frm_GETHEADER, 0, 0);
SetWindowLong (header, GWL_EXSTYLE,
GetWindowLong (header, GWL_EXSTYLE) or
WS_EX_LAYOUTRTL or WS_EX_NOINHERITLAYOUT);
SetWindowLong (Form1.Handle, GWL_EXSTYLE,
GetWindowLong (Form1.Handle, GWL_EXSTYLE) or
WS_EX_LAYOUTRTL or WS_EX_NOINHERITLAYOUT);
Form1.invalidate;
end;
initialization
with Application do begin
NonBiDiKeyboard:= SysLocale.DefaultLCID;
BiDiKeyboard:= LangHeb;
SysLocale.MiddleEast := True;
BiDiMode := bdRightToLeft;
ActivateKeyboardLayout(LangDef, 0);
end;