Autor Beitrag
mimi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 3458

Ubuntu, Win XP
Lazarus
BeitragVerfasst: Sa 26.04.03 16:52 
Hallo,
ich habe folgende funktion:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
function GetKeyName(Key:Word):String;
begin
  if Key = VK_LEFT then result:='Pfeil Taste Links';
  if Key = VK_RIGHT then result:='Pfeil Taste Rechts';
  if Key = VK_UP then result:='Pfeil Taste Oben';
  if Key = VK_Down then result:='Pfeil Taste Unten';  
end;

gibt es eine besser möglichkeit für diese funktion ?

_________________
MFG
Michael Springwald, "kann kein englisch...."
FloSch
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 129



BeitragVerfasst: Sa 26.04.03 16:53 
Hallo,

warum besser ?! :?:

Grüße
Florian :roll:

_________________
Windows 200 Prof. - Debian Sarge
D5 Prof & D6 PE - Kylix 3 Professional - Free Pascal
mimi Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 3458

Ubuntu, Win XP
Lazarus
BeitragVerfasst: Sa 26.04.03 17:01 
weil das so recht umständlich ist, und auserdem müsste ich wenn ich neue tasten umwandel wie z.b. die ESC Taste, dann muss ich ja die die Funktion erweitern... ich dachte an sowas wie es chr macht aber nur halt, das er ein String zurück geben MUSS

_________________
MFG
Michael Springwald, "kann kein englisch...."
tommie-lie
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 4373

Ubuntu 7.10 "Gutsy Gibbon"

BeitragVerfasst: Sa 26.04.03 17:56 
Vielleicht so?:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
  case key of
    VK_LEFT:    result := 'Linke Pfeiltaste';
    VK_RIGHT:   result := 'Rechte Pfeiltaste';
    VK_UP:      result := 'Obere Pfeiltaste';
    VK_DOWN:    result := 'Untere Pfeiltaste';
    VK_ESCAPE:  result := 'Escape';
    VK_F1:      result := 'F1';
  end;

  result := result + ' wurde gedrückt';

Lässt sich auf jeden Fall mit weniger Tipparbeit erweitern.

_________________
Your computer is designed to become slower and more unreliable over time, so you have to upgrade. But if you'd like some false hope, I can tell you how to defragment your disk. - Dilbert
MSCH
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1448
Erhaltene Danke: 3

W7 64
XE2, SQL, DevExpress, DevArt, Oracle, SQLServer
BeitragVerfasst: Sa 26.04.03 17:59 
nimm ein Array mit Records.

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
type
  tScanCodes = Record
  Code: Integer; // der Tastaturcode
  StrCode: String; // Umsetzung als String
end;

const
  ScanCodes : Array[0..n] of tScanCodes =(code:VK_Return;StrCode:'...'); // u.s.w.


in der Funktion durchsuchst du das Array und wenn Array[n].Code=Key dann gibst du Array[n].StrCode zurück.

So zumindest die Theorie.

grez.
msch
mimi Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 3458

Ubuntu, Win XP
Lazarus
BeitragVerfasst: Sa 26.04.03 18:43 
ok... ich dachte dafür gibt es schon eine funktion, aber ich sehe, anscheiend gibt es keine.... dann werde ich mal eine bauen.

_________________
MFG
Michael Springwald, "kann kein englisch...."
wulfskin
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1349
Erhaltene Danke: 1

Win XP
D5 Pers (SSL), D2005 Pro, C, C#
BeitragVerfasst: So 27.04.03 00:20 
Meinst du diese Funktion:  function ShortCutToText(ShortCut: TShortCut): string;?

_________________
Manche antworten um ihren Beitragszähler zu erhöhen, andere um zu Helfen.
mimi Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 3458

Ubuntu, Win XP
Lazarus
BeitragVerfasst: So 27.04.03 17:39 
ach genau... so hieß sie ja..... danke...

_________________
MFG
Michael Springwald, "kann kein englisch...."