module key_event




  • platform: Triggers compilation for the android platform


  • at_boot: Import this module to launch Service at device boot
  • http_request: Android implementation of app:http_request
  • native_ui: Native services from the android.view and android.widget namespaces
  • nit_activity: Core implementation of app.nit on Android using a custom Java entry point
  • service: Android service support for app.nit centered around the class Service
  • ui: Views and services to use the Android native user interface
  • ui_test: Test for app.nit's UI services
  • wifi: Simple wrapper of the Android WiFi services


  • android: Android platform support and APIs
  • core: Nit common library of core classes and methods
    • kernel: Most basic classes and methods.

in android::key_event


extern class NativeKeyEvent

Java class: android.view.KeyEvent

  • is_system: Java implementation: boolean android.view.KeyEvent.isSystem()
  • set_source: Java implementation: android.view.KeyEvent.setSource(int)
  • meta_state: Java implementation: int android.view.KeyEvent.getMetaState()
  • modifiers: Java implementation: int android.view.KeyEvent.getModifiers()
  • flags: Java implementation: int android.view.KeyEvent.getFlags()
  • has_no_modifiers: Java implementation: boolean android.view.KeyEvent.hasNoModifiers()
  • has_modifiers: Java implementation: boolean android.view.KeyEvent.hasModifiers(int)
  • is_alt_pressed: Java implementation: boolean android.view.KeyEvent.isAltPressed()
  • is_shift_pressed: Java implementation: boolean android.view.KeyEvent.isShiftPressed()
  • is_sym_pressed: Java implementation: boolean android.view.KeyEvent.isSymPressed()
  • is_ctrl_pressed: Java implementation: boolean android.view.KeyEvent.isCtrlPressed()
  • is_meta_pressed: Java implementation: boolean android.view.KeyEvent.isMetaPressed()
  • is_function_pressed: Java implementation: boolean android.view.KeyEvent.isFunctionPressed()
  • is_caps_lock_on: Java implementation: boolean android.view.KeyEvent.isCapsLockOn()
  • is_num_lock_on: Java implementation: boolean android.view.KeyEvent.isNumLockOn()
  • is_scroll_lock_on: Java implementation: boolean android.view.KeyEvent.isScrollLockOn()
  • action: Java implementation: int android.view.KeyEvent.getAction()
  • is_canceled: Java implementation: boolean android.view.KeyEvent.isCanceled()
  • start_tracking: Java implementation: android.view.KeyEvent.startTracking()
  • is_tracking: Java implementation: boolean android.view.KeyEvent.isTracking()
  • is_long_press: Java implementation: boolean android.view.KeyEvent.isLongPress()
  • key_code: Java implementation: int android.view.KeyEvent.getKeyCode()
  • characters: Java implementation: java.lang.String android.view.KeyEvent.getCharacters()
  • scan_code: Java implementation: int android.view.KeyEvent.getScanCode()
  • repeat_count: Java implementation: int android.view.KeyEvent.getRepeatCount()
  • down_time: Java implementation: long android.view.KeyEvent.getDownTime()
  • event_time: Java implementation: long android.view.KeyEvent.getEventTime()
  • display_label: Java implementation: char android.view.KeyEvent.getDisplayLabel()
  • unicode_char: Java implementation: int android.view.KeyEvent.getUnicodeChar()
  • number: Java implementation: char android.view.KeyEvent.getNumber()
  • is_printing_key: Java implementation: boolean android.view.KeyEvent.isPrintingKey()

from core::kernel


redef class Sys

The main class of the program.

Sys is a singleton class, its only instance is accessible from everywhere with sys.

Because of this, methods that should be accessible from everywhere, like print or exit, are defined in Sys. Moreover, unless there is an ambiguity with self, the receiver of a call to these methods is implicitly sys. Basically it means that the two following instructions are equivalent.

print "Hello World"
sys.print "Hello World"

Methods Implicitly Defined in Sys

Sys is the class where are defined top-level methods, i.e. those defined outside of any class like in a procedural language. Basically it means that

redef class Sys
   fun foo do print "hello"

is equivalent with

fun foo print "hello"

As a corollary, in a top-level method, self (the current receiver) is always sys.