Thema: Delphi j-Taste abfangen?

Einzelnen Beitrag anzeigen

Benutzerbild von milos
milos

Registriert seit: 14. Jul 2008
Ort: Bern (CH)
508 Beiträge
 
Delphi 11 Alexandria
 
#24

AW: j-Taste abfangen?

  Alt 6. Apr 2015, 13:17
Ich denke wenn du alle Tastaturlayouts unterstützen willst, wäre es am besten wenn du das Layout beim anzeigen und beim ausblenden der Form anpasst und du trotzdem nur mit einem Layout arbeiten kannst.

Also...

Bei FormShow wird das Tastaturlayout auf deutsch gesetzt. Somit kannst du ein einfaches "j" abfragen und jeder wird bei der Taste mit dem Strich, wo bei uns das normale "j" ist, ein "j" schicken.

Dieser Code setzte das Layout auf das Deutsche Layout.
Delphi-Quellcode:
var kbCOde : LongWord;
kbString : Array[0..9] of char;
begin
// The following line is the translation of the MAKELANGID
// macro explained in the WIN32 developper's reference help.
// if you start with "LoadKeyBoardLayout" then click the hyperlink
// to MAKELANGID. You will see all the constant I've used here.
// No more "magic numbers" like 409 or 419.

kbCode := (SUBLANG_DEFAULT shl 10) or LANG_GERMAN;

// The line below is to switch to a french canadian keyboard
//kbCode := (SUBLANG_FRENCH_CANADIAN shl 10) or LANG_FRENCH;

//Convert the binary code to an Hex string;
StrPCopy(kbString, IntToHex(kbCode, 8));

// Switch the keyboard know
LoadKeyboardLayout(@kbString, KLF_ACTIVATE);
end;
Quelle: http://www.delphipages.com/forum/sho...57&postcount=3

Wenn das ausgeführt wurde, kannst du ein einfaches J abfragen.


Das bei dem Kyrillischem Layout ein ? gesendet wird liegt wohl am ascii string.
Milos

Geändert von milos ( 6. Apr 2015 um 13:22 Uhr)
  Mit Zitat antworten Zitat