![]() |
UpperCase Problem
Hallo,
mit der UpperCase-funktion mache ich ja bekannterweise aus klein geschriebenen Buchstaben, große ^^ Aber was ich gerne hätte, dass auch z.b. aus einem ß ein ? wird, also ne Art Shift-Tasten Funktion. Kann mir da jemand weiterhelfen, ohne, dass ich selbst die Codes umwandeln muss? Gruß Logic |
Re: UpperCase Problem
Hallo,
Das kannst du mit MapVirtualKey / ToAscii realisieren. (funktioniert auch mit alt gr + ....)
Delphi-Quellcode:
function GetCharFromVirtualKey(Key: Word): string;
var KBDState: TKeyboardState; asciiRes: Byte; begin GetKeyboardState(KBDState) ; SetLength(Result, 2) ; asciiRes := ToAscii(key, MapVirtualKey(key, 0), KBDState, @Result[1], 0) ; case asciiRes of 0: Result := ''; // The specified virtual key has no translation for the current state of the keyboard. 1: SetLength(Result, 1) ; // One Windows character was copied to the buffer. 2:; // Two characters were copied to the buffer. This usually happens when a dead-key character (accent or diacritic) stored in the keyboard layout cannot be composed with the specified virtual key to form a single character. end; end; procedure TForm1.Edit1KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin Caption := GetCharFromVirtualKey(Key) ; end; |
Re: UpperCase Problem
Da wirst du wohl nicht herumkommen.
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 20:29 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz