DisplayOnscreenKeyboard: poll UpdateOnscreenKeyboard() — 1=entered, 2=cancelled; title must be an AddTextEntry key
Context
The on-screen keyboard is asynchronous and its result must be polled. Reading the result without checking status returns stale or nil data.
The pattern
AddTextEntry("FMMC_KEY_TIP1", label) -- register a text-entry KEY
DisplayOnscreenKeyboard(1, "FMMC_KEY_TIP1", "", default, "", "", "", maxLength)
while true do
Wait(0)
local status = UpdateOnscreenKeyboard() -- must call every frame
if status == 1 then return GetOnscreenKeyboardResult() -- entered
elseif status == 2 then return nil end -- cancelled
end
The trap
- The
title/description args are text-entry keys, not literal strings — register them withAddTextEntryfirst. UpdateOnscreenKeyboard()returns1(entered),2(cancelled), or other (still open). Only readGetOnscreenKeyboardResult()on1; otherwise you get stale/nil.
Verified
input/client.lua:12-26. The native documents the textType enum but not the status-code polling contract.
Tags: input, keyboard, updateonscreenkeyboard, polling, addtextentry, hud
Category: natives
Source: jo_libs-fleet
Created: 2026-05-31T09:40:26.134Z