This is an OnKeyPress procedure to enter Hebrew UTF8 characters. It does the entries for a few consonants and vowels.... Consonants: ', b, g, d, and Vowels: i, e, a.
I have tried various methods but this is the only one that works. Its problem is that the cursor does not move with the entires. Nothing that I do can move it. I have have tried OnKeyDown, OnKeyUp, and Windows Widgets.
Apparently it does nothing until the procedure exits, and then it does all of the standing entries. It treats OnKeyUp as an extension of OnKeyDown and OnKeyPress, not doing any thin until all events have finished, and using only the standing settings.
It also does an illogical left-arrow and right-arrow. Left should be left, and right should be right. When moving by arrow keys it also gets lost on where it should be.
Additionally, I cannot enter a period, space, nor any other character that would separate words. It treats them as English and garbages the natural Right-to-Left flow.
procedure TCmdForm.CheckLanguage(Sender: TObject; var Key: char);
var Hkey, HebrewOn: boolean;
begin
HebrewOn:= true; // this normally set globally
if HebrewOn then
begin
LastCursorPos:= PageMemo.SelStart;
Hkey:= false;
Case Key of
{'}#39 : begin PageMemo.SelText:= UnicodeToUTF8(1488); Hkey:= true; end; // alf
'b' : begin PageMemo.SelText:= UnicodeToUTF8(1489); Hkey:= true; end; // bth
'g' : begin PageMemo.SelText:= UnicodeToUTF8(1490); Hkey:= true; end; // gml
'd' : begin PageMemo.SelText:= UnicodeToUTF8(1491); Hkey:= true; end; // dlt
'i' : begin PageMemo.SelText:= UnicodeToUTF8(1460); Hkey:= true; end; // xrk
'e' : begin PageMemo.SelText:= UnicodeToUTF8(1462); Hkey:= true; end; // sgl
'a' : begin PageMemo.SelText:= UnicodeToUTF8(1463); Hkey:= true; end; // ptx
'.' : begin PageMemo.SelText:= '.'; Hkey:= true; end;
' ' : begin PageMemo.SelText:= ' '; Hkey:= true; end;
end;
if Hkey then
begin
Key:= #0;
PageMemo.SelStart:= PageMemo.SelStart+1;
PageMemo.SelLength:= 0;
PageMemo.setfocus;
end;
end;
end;
I have searched for methods that might apply, and nothing is applicable.
Rick