Function OnKeyboard

function OnKeyboard(char)
	...
end function

This is an event function you can overload to perform some actions when a keyboard button is pressed. This event is fired when either a button on physical keyboard or a virtual button on an on-screen keyboard is pressed. Example:

function OnKeyboard(char)
	ClearScreen()
	SetFontSize(50)
	DrawText(100, 100, char)
end function
If a non-character keyboard button is pressed, the function parameter can have one of the following values:
    "VK_LEFT"
  • "VK_RIGHT"
  • "VK_UP"
  • "VK_DOWN"
  • "VK_HOME"
  • "VK_END"
  • "VK_INSERT"
  • "VK_DELETE"
  • "VK_F1"
  • "VK_F2"
  • "VK_F3"
  • "VK_F4"
  • "VK_F5"
  • "VK_F6"
  • "VK_F7"
  • "VK_F8"
  • "VK_F9"
  • "VK_F10"
  • "VK_F11"
  • "VK_F12"
  • "VK_ALT"
  • "VK_CONTROL"
  • "VK_PAGE_UP"
  • "VK_PAGE_DOWN"
  • "VK_BACKSPACE"
  • "VK_ESCAPE"
  • "VK_TAB"
  • "VK_ENTER"
  • "VK_CONTROL_ENTER"
Here is another small example:
function OnKeyboard(char)
	ClearScreen()
	SetFontSize(50)
	if char = "VK_ENTER"
		DrawText(100, 100, "Enter Pressed")
	end if
end function

See also: