Autor Beitrag
Peter2002
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 103

Win XP, Win 7
Delphi 2007 / XE3
BeitragVerfasst: Di 22.10.02 09:20 
Wie kann ich abfragen, ob Shift + Funktionstaste gedrückt wurde?

Danke
AndyB
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1173
Erhaltene Danke: 14


RAD Studio XE2
BeitragVerfasst: Di 22.10.02 09:44 
In OnKeyDown/OnKeyUp/OnMouseDown/OnMouseMove/OnMouseUp kannst du mit
if ssShift in Shift then ...den prüfen, ob die Shift-Taste gedrückt wurde.

Ansonsten kann man mit dieser Anweisung zu jedem Zeitpunkt den Shift-Status abfragen.
ausblenden Quelltext
1:
2:
3:
4:
function IsShiftPressed: Boolean;
begin
  Result := GetAsyncKeyState(VK_SHIFT) and $80 <> 0;
end;

_________________
Ist Zeit wirklich Geld?
Peter2002 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 103

Win XP, Win 7
Delphi 2007 / XE3
BeitragVerfasst: Di 22.10.02 09:58 
Also, ich habs mal mit
ausblenden Quelltext
1:
if (ssShift in Shift) and (key = vk_F8) then ShowMessage('F20');					

versucht ... Die Meldung kommt nie
Wenn ich nur den Shift-Status abfrage, dann kommt die Meldung, nimm ich aber mein F8 dazu, gehts nimmer :?!?:
LCS
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1305
Erhaltene Danke: 1

WIN 7, WIN 8
Delphi XE5, Delphi XE, Delphi 2007
BeitragVerfasst: Di 22.10.02 10:35 
Hi
also bei mir funktioniert das einwandfrei. Poste doch mal die ganze Prozedur.

Gruss Lothar

_________________
Der BH ist für die Brust, der Plan ist für'n Ar...
AndyB
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1173
Erhaltene Danke: 14


RAD Studio XE2
BeitragVerfasst: Di 22.10.02 10:37 
Also bei mit funktioniert der Code im OnKeyDown Ereignis des Formulars.

_________________
Ist Zeit wirklich Geld?
Peter2002 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 103

Win XP, Win 7
Delphi 2007 / XE3
BeitragVerfasst: Di 22.10.02 12:30 
Bei mir funktioniert der von mir vhorhin gepostete Code nur im OnKeyUp.
Im OnKeyDown nicht. Warum?
mk2
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 72

WIN 2000
D4 Prof
BeitragVerfasst: Di 22.10.02 13:35 
@ peter 2002

ich glaub der grund warum das bei dir nicht funktioniert, ist das du komponenten, wie buttons oder so was auf deinem formular hast. Sobald die da sind, benötigt delphi bestimmte tasten (wie z.B. Tab, Cursor und wahrscheinlisch auch shift) um diese komponenten zu steuern (focus setzen etc) und löst für diese tasten kein onkeydown mehr aus.

Ich hab aber leider auch keine lösung dafür außer halt statt onkeydown onkeyup zu nehmen.

mfg mk2