Difference between revisions of "IsFunctionKeyDown"

From SCAR Divi Manual
Jump to: navigation, search
(Created page with "==Definition== <source lang="scar" lines="false"> function IsFunctionKeyDown(Key: Byte): Boolean; </source> ===Source Code=== <source lang="scar"> function IsFunctionKeyDown(Key...")
 
(Definition)
Line 10: Line 10:
 
   Result := False;
 
   Result := False;
 
   case Key of
 
   case Key of
     0: Result := (GetAsyncKeyState(VK_SHIFT) <> 0);
+
     0: Result := GetAsyncKeyState(VK_SHIFT) <> 0;
     1: Result := (GetAsyncKeyState(VK_CONTROL) <> 0);
+
     1: Result := GetAsyncKeyState(VK_CONTROL) <> 0;
     2: Result := (GetAsyncKeyState(VK_MENU) <> 0);
+
     2: Result := GetAsyncKeyState(VK_MENU) <> 0;
     3: Result := (GetAsyncKeyState(VK_LSHIFT) <> 0);
+
     3: Result := GetAsyncKeyState(VK_LSHIFT) <> 0;
     4: Result := (GetAsyncKeyState(VK_LCONTROL) <> 0);
+
     4: Result := GetAsyncKeyState(VK_LCONTROL) <> 0;
     5: Result := (GetAsyncKeyState(VK_LMENU) <> 0);
+
     5: Result := GetAsyncKeyState(VK_LMENU) <> 0;
     6: Result := (GetAsyncKeyState(VK_RSHIFT) <> 0);
+
     6: Result := GetAsyncKeyState(VK_RSHIFT) <> 0;
     7: Result := (GetAsyncKeyState(VK_RCONTROL) <> 0);
+
     7: Result := GetAsyncKeyState(VK_RCONTROL) <> 0;
     8: Result := (GetAsyncKeyState(VK_RMENU) <> 0);
+
     8: Result := GetAsyncKeyState(VK_RMENU) <> 0;
 
   end;
 
   end;
 
end;
 
end;

Revision as of 01:55, 5 July 2011

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 > Current

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