AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

UpperCase Problem

Ein Thema von Logic · begonnen am 27. Apr 2008 · letzter Beitrag vom 28. Apr 2008
Antwort Antwort
Benutzerbild von Logic
Logic

Registriert seit: 28. Nov 2003
132 Beiträge
 
Delphi 7 Personal
 
#1

UpperCase Problem

  Alt 27. Apr 2008, 23:39
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
  Mit Zitat antworten Zitat
Benutzerbild von toms
toms
(CodeLib-Manager)

Registriert seit: 10. Jun 2002
4.648 Beiträge
 
Delphi XE Professional
 
#2

Re: UpperCase Problem

  Alt 28. Apr 2008, 05:38
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;
Thomas
  Mit Zitat antworten Zitat
mkinzler
(Moderator)

Registriert seit: 9. Dez 2005
Ort: Heilbronn
39.851 Beiträge
 
Delphi 11 Alexandria
 
#3

Re: UpperCase Problem

  Alt 28. Apr 2008, 05:39
Da wirst du wohl nicht herumkommen.
Markus Kinzler
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 12:32 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz