Forum > General
TStringGrid with BiDiMode:= bdRightToLeft does not work.
Avishai:
TStringGrid with BiDiMode:= bdRightToLeft and SysLocale.MiddleEast:= True does not work. It is completely unusable. Any help would be very much appreciated.
ik:
SysLocale is ignored in Lazarus because it is not compatible with other operating systems.
I'm yet to understand what exactly are the problems you have, and why you keep on creating your own Bidi support. can you please upload an image and a proof of concept code of what you are trying to do ?
Avishai:
BiBiMode depends on SysLocale. It's used by many objects in Delphi and in Lazarus to determine how to draw and respond to different Languages like Hebrew and Arabic that are not Left to Right languages. In Hebrew we read and write from Right to Left except for numbers that go from Left to Right. That's why it's called a Bi-Directional language.
If you set SysLocale.MiddleEast:= True and add a TStringGrid to a Form and set it's BiDiMode to bdRightToLeft, you will see that it mirrors the grid so that it is Right to Left, only it gets very flaky. If you do the same with a TEdit, it will also mirror, only it works properly. The image I have attached does not use a StringGrid because it is unusable at present.
SysLocale is declared in SysInth.inc as follows.
type
TSysLocale = record
{ Delphi compat fields}
DefaultLCID,
PriLangID,
SubLangID : Integer;
case byte of
{ win32 names }
1 : (FarEast: boolean; MiddleEast: Boolean);
{ real meaning }
2 : (MBCS : boolean; RightToLeft: Boolean);
end;
var
SysLocale : TSysLocale;
Avishai:
It looks like you may be right. SysLocale seems to have no effect on the BiDiMode. That means I can delete a line from the code.
ik:
Avishai, I'm a native Hebrew speaker like yourself, and I research the Bidi issue for more then 11 years now, so I know a lot regarding Hebrew and other languages that require Bi-Directional support.
SysLocale record is initialized only in MS-Windows, so it's not a cross platform record.
Claiming that all middle east languages are right to left is wrong. some of them are written in Latin letters today, and latin is written from left to right, so only the RightToLeft field should be used, but as I said, it's very Windows oriented and Lazarus is a cross platform environment that is created in the mindset of writing more general code rather then specific environment specific code. That's why the LCL support so many widgets on many systems, and that's why we mostly recommend not to use specific API unless you must use it.
I still do not understand the problem/bug you have with BiDiMode, and what you are trying to do exactly that was not given to you. As I see, the Hebrew with the punctuation (ניקוד) are written properly from right to left, and so does the grid seems to be from right to left.
Navigation
[0] Message Index
[#] Next page