Skip to content

system.killEvents

since 1.1.0

Kill key events (i.e. after a LONG PRESS event, a KEY RELEASE event may be skipped)

system.killEvents(event)

Parameters

Name Type Required Description
event number yes

Returns

Nothing.

Examples

local function event(widget, category, value, x, y)
  if category == EVT_KEY and value == KEY_ENTER_LONG then
    openMenu(widget)
    system.killEvents(KEY_ENTER_BREAK)   -- the release would otherwise also count as a short press
    return true
  end
  return false
end

Real projects also kill touch sequences after acting on a touch (system.killEvents(TOUCH_START)) so the rest of the gesture doesn't reach other UI.

Real-world usage

Called 41 times across 5 open-source Ethos Lua projects. A few short excerpts:
system.killEvents(KEY_ENTER_BREAK)

src/dashx/app/app.lua:440

if system.killEvents then
    system.killEvents(value)

src/ofs3/widgets/dashboard/lib/logviewer.lua:911

if opts.setEventHandler then
  opts.setEventHandler(function(category, value)
    if value == KEY_ENTER_LONG then
      system.killEvents(KEY_ENTER_BREAK)

src/rfsuite/app/pages/ports.lua:574