Autor Beitrag
bruce185
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 283

winXP
D7 Ent
BeitragVerfasst: Do 07.02.08 15:38 
Hallo,
ich habe ein kleines problem und zwar, möchte ich die Keys in Zeichen umwandeln, wenn ich es umwandel, dann werden diese immer in Gross Buchstabe umgewandelt obwohl ich nicht die Shift Taste gedrückt halte:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
procedure TForm1.RichEdit1KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  taste := Chr(Key);
  Label1.Caption := 'Du hast '+taste+' gedrückt!';
end;


Ich möchte das wenn ich nicht die Shift Taste halte, das diese Keys in klein buchstaben umgewandelt werden und wenn ich die Shift Taste halte, das diese dann in gross buchstabe umgewandelt werden.

Wie könnte ich das ambesten lösen?

Ich bedanke mich schonmal im Voraus.

MfG


Moderiert von user profile iconNarses: Topic aus Delphi Language (Object-Pascal) / CLX verschoben am Do 07.02.2008 um 15:41
_frank_
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 343
Erhaltene Danke: 1

Win XP
Delphi 3 Prof / Turbo Delphi Explorer
BeitragVerfasst: Do 07.02.08 15:55 
was spricht gegen
ausblenden Delphi-Quelltext
1:
if not ssShift in Shift then taste:=lowercase(taste);					


HTH Frank

_________________
EB FE (die wahrscheinlich kürzeste Endlosschleife der Welt :) )
BA 01 00 00 00 52 EB 09 BB 4D 11 86 7C FF D3 EB 0D E8 F2 FF FF FF 63 68 61 72 6D 61 70 00 C3
bruce185 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 283

winXP
D7 Ent
BeitragVerfasst: Do 07.02.08 16:03 
Danke Dir.
Ich wollte das auch erst mit LowerCase lösen aber das bringt mir nicht weiter, weil es noch andere Zeichen gibt außer Buchstaben.

Kann man das nicht irgendwie anders lösen?

MfG
_frank_
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 343
Erhaltene Danke: 1

Win XP
Delphi 3 Prof / Turbo Delphi Explorer
BeitragVerfasst: Do 07.02.08 16:11 
welche zeichen wären das z.B.?
evtl musst halt manuell den keycode umrechnen á la

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
if not sshift in Shift then
begin
  case key of
    65..90:taste:=char(key+32);
    //andere zeichen ggf. per key+-x berechnen
  end;
end;


gruß Frank

_________________
EB FE (die wahrscheinlich kürzeste Endlosschleife der Welt :) )
BA 01 00 00 00 52 EB 09 BB 4D 11 86 7C FF D3 EB 0D E8 F2 FF FF FF 63 68 61 72 6D 61 70 00 C3
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Do 07.02.08 16:58 
Hehe, manche Antworten sind schon kreativ :lol:.

Benutze OnKeyPress. Da wird der Key als Char mit Groß-/Kleinschreibung geliefert.

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
bruce185 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 283

winXP
D7 Ent
BeitragVerfasst: Do 07.02.08 17:23 
user profile iconGTA-Place hat folgendes geschrieben:
Hehe, manche Antworten sind schon kreativ :lol:.

Benutze OnKeyPress. Da wird der Key als Char mit Groß-/Kleinschreibung geliefert.


Schön wärs aber ich kann keine Key abfrage in OnKeyPress machen :roll:

ausblenden Delphi-Quelltext
1:
[Fehler] Unit1.pas(109): Inkompatible Typen					


EDIT: Sry, war mein fehler, nun funktioniert es, Danke.

MfG