Difference between revisions of "IsFunctionKeyDown"

From SCAR Divi Manual
Jump to: navigation, search
(Definition)
 
Line 24: Line 24:
  
 
==Availability==
 
==Availability==
SCAR Divi 3.00 > Current
+
SCAR Divi 3.00 > 3.34
  
 
==Description==
 
==Description==
Line 56: Line 56:
 
*[[IsKeyDown]]
 
*[[IsKeyDown]]
  
[[Category:Functions]]
+
[[Category:Deprecated Functions]]
[[Category:Keyboard Functions]]
 

Latest revision as of 16:31, 10 November 2012

Definition

function IsFunctionKeyDown(Key: Byte): Boolean;

Source Code

function IsFunctionKeyDown(Key: Byte): Boolean;
begin
  Result := False;
  case Key of
    0: Result := GetAsyncKeyState(VK_SHIFT) <> 0;
    1: Result := GetAsyncKeyState(VK_CONTROL) <> 0;
    2: Result := GetAsyncKeyState(VK_MENU) <> 0;
    3: Result := GetAsyncKeyState(VK_LSHIFT) <> 0;
    4: Result := GetAsyncKeyState(VK_LCONTROL) <> 0;
    5: Result := GetAsyncKeyState(VK_LMENU) <> 0;
    6: Result := GetAsyncKeyState(VK_RSHIFT) <> 0;
    7: Result := GetAsyncKeyState(VK_RCONTROL) <> 0;
    8: Result := GetAsyncKeyState(VK_RMENU) <> 0;
  end;
end;

Availability

SCAR Divi 3.00 > 3.34

Description

Returns true if a function key specified by Key was pressed.

Keys

  • 0: Shift
  • 1: Control
  • 2: Menu
  • 3: Left Shift
  • 4: Left Control
  • 5: Left Menu
  • 6: Right Shift
  • 7: Right Control
  • 8: Right Menu

Example

begin
  repeat
    Wait(500)
  until IsFunctionKeyDown(4);
  WriteLn('Pressed the left control key');
end.

See Also