On screen keyboard - Russian

Hi Experts
I have an application that uses an on-screen keyboard - I pick up the caption on each button, and use it as the upper case character.  So I can use the translation manager to change keyboard format.
Now I need to do this for Russian.  What is the best way to map the cyrillic characters?  If I use the old code, the mapping is not correct.
Thanks
procedure TKbdForm.Button1Click(Sender: TObject);
var
  sx : ShortString;
  n  : integer;
  lang : integer;
  c1   : integer;
begin
    if Sender is TButton then
    begin
      EntryBox.SetFocus;
      if not firstkey then EntryBox.SelStart := EntryBox.SelLength;
      firstkey := false;
      c1 := ord(TButton(Sender).Caption[1]);
      lang := Sysutils.SysLocale.DefaultLCID and $ff;
      if lang=LANG_RUSSIAN then
      begin
        Something_different;
        keybd_event(c1,0,0,0);
      end
      else
      begin
        keybd_event(VK_SHIFT, MapVirtualKey(VK_SHIFT, 0), 0, 0);
        keybd_event(ord(TButton(Sender).Caption[1]),0,0,0);
        keybd_event(VK_SHIFT, MapVirtualKey(VK_SHIFT, 0), KEYEVENTF_KEYUP, 0);
      end;
    end;
end;

Open in new window

diver999Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ferruccio AccalaiSenior developer, analyst and customer assistance Commented:
What about changing the Font.charset to russian?

just from head, something like

...
 if lang=LANG_RUSSIAN then
      begin
        TButton(Sender).Font.Charset := RUSSIAN_CHARSET;
        keybd_event(ord(TButton(Sender).Caption[1]),0,0,0);
      end
      else
      begin
...
0
diver999Author Commented:
I tried this.
Captions "A", "B", etc come up as russian characters
But russian characters are not displayed - c1 > 127.   (c1=ord(Tbutton(Sender).caption[1])
Any other ideas ??
0
Ferruccio AccalaiSenior developer, analyst and customer assistance Commented:
Why are you using the ord(chr) stuff?

Try using VKKeySkan that returns the right character translation for the virtual key code

keybd_event(VKKeySkan(TButton(Sender).Caption[1]),0,0,0);
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
diver999Author Commented:
OK - that's much better
I try to write the string to a Paradox database alpha field but it comes out "#####"
Do you want me to post another question for this ?
0
Ferruccio AccalaiSenior developer, analyst and customer assistance Commented:
It' should depend on the Table Language checked in your BDE Configuration.
In a Russian System it should be Pdox ANSI Cyrillic
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.