Difference between revisions of "IsNumpadKeyDown"

From SCAR Divi Manual
Jump to: navigation, search
(Created page with "==Definition== <source lang="scar" lines="false"> function IsNumpadKeyDown(Key: Byte): Boolean; </source> ===Source Code=== <source lang="scar"> function IsNumpadKeyDown(Key: By...")
(No difference)

Revision as of 01:01, 5 July 2011

Definition

function IsNumpadKeyDown(Key: Byte): Boolean;

Source Code

function IsNumpadKeyDown(Key: Byte): Boolean;
var
  pKey: Byte;
begin
  if Key < 10 then
    pKey := 96 + Key
  else
    case Key of
      10: pKey := VK_NUMLOCK;
      else Exit(False);
    end;
  Result := (pKey < 11) and (GetAsyncKeyState(pKey) <> 0);
end;

Availability

SCAR Divi 3.00 > Current

Description

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

Keys

  • 0-9: Numpad keys 0 to 9
  • 10: Numlock

Example

begin
  repeat
    Wait(500)
  until IsNumpadKeyDown(2);
  WriteLn('Pressed numpad key 2');
end.

See Also