Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2004-11

keyboard layout.

3 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Marco van de Voort

We are having a problem with keyboard layouts in the keyboard unit in windows. Currently it is automatically assumed that both alt keys differ.

So this is a small poll:

What is your Windows keyboardlayout, and are your two alt keys different (ALT-GR system)?

Me:

Layout: ALT-GR ?
US no

Reply by email

Marco van de Voort
to Marco van de Voort
Show quoted text 11 lines
We are having a problem with keyboard layouts in the keyboard unit in windows. Currently it is automatically assumed that both alt keys differ. So this is a small poll: What is your Windows keyboardlayout, and are your two alt keys different (ALT-GR system)? Me: Layout: ALT-GR ? US no

Florian dug up some C++ code that I tried to convert. Could sb try to run this on his windows machine, and check if the ALT-GR status is detected correctly.

Please also mention your windows version, since I found notes here and there that some aspects of keyboardlayouts are NT specific.

program printlayout;
{$mode delphi}
Uses SysUtils,Windows;
 // Checks if the right-hand ALT key is used as a 2nd shift key
var hklold    : HKL = 0;
var HasAltGr  : Boolean = false;
procedure CheckAltGr;
var ahkl : HKL;
    i    : integer;
 begin
   HasAltGr:=FALSE;
   ahkl:=GetKeyboardLayout(0);
   if (hklOldahkl) then
     Begin
       hklOld:=ahkl;
       i:=$20;
       while i<$100 do
         begin
           // <MSDN>
           // For keyboard layouts that use the right-hand ALT key as ashift key
           // (for example, the French keyboard layout), the shift state is
           // represented by the value 6, because the right-hand ALT key is
           // converted internally into CTRL+ALT.
           // </MSDN>
          if (HIBYTE(VkKeyScanEx(chr(i),ahkl))=6) then
            begin
              HasAltGr:=TRUE;
              break;
            end;
         inc(i);
        end;
     end;
end;
begin
 writeln(hexstr(getkeyboardlayout(0),8));
 CheckAltGr;
 if HasAltGr then writeln(' Has altgr') else writeln('shouldn''t have alt-gr');
end.

Reply by email

Tomas Hajny

On Sun, 21 Nov 2004 11:56:22 +0100 (CET), Marco van de Voort wrote

Show quoted text 8 lines
> We are having a problem with keyboard layouts in the keyboard unit in windows. > Currently it is automatically assumed that both alt keys differ. > > So this is a small poll: > > What is your Windows keyboardlayout, and are your two alt keys different (ALT-GR system)?

.
.

Florian dug up some C++ code that I tried to convert. Could sb try to run this on his windows machine, and check if the ALT-GR status is detected correctly.

.
.

As it was already mentioned in the original post, this test only shows what the primary (default) layout has. I made the effort to check Alt-Gr behaviour on all the layouts supported on my W2K installation (basically, all latin layouts, i.e. all layouts for Europe except languages using cyrillic plus layouts for both Americas). Out of these, I only found 4 layouts not having support for Alt-Gr: "US", "US-Dvorak", "US-Dvorak (left-handed)" and "US-Dvorak (right handed)". It might be interesting to get information about Alt-Gr support from one of our russian users, then from e.g. Mazen and possibly from somebody using Chinese or Japanese to make the picture more complete. However, I suspect these all would have support for Alt-Gr, because they all need rather more than less keys. I only tested the "printlayout" check randomly for some of the tested layouts (I was changing layout for the default locale - fortunately, you can do this without restarting and it comes into effect immediately), and it worked as expected.

Tomas

Reply by email