Skip to content

Mobile controls

Nexus Mobile provides a phone-oriented application engine and an embedded Lua control library, nexus.ui. Use it for business applications as well as games.

Construct controls in Lua

local ui = require("nexus.ui")

local panel = ui.newPanel {
    x = display.contentCenterX, y = display.contentCenterY,
    width = 320, height = 480
}
local name = ui.newEdit {
    parent = panel, y = -40, placeholder = "Your name"
}
local save = ui.newButton {
    parent = panel, y = 40, text = "Save",
    onClick = function() print(name.text) end
}

The library is built into the engine. Applications use the same import in the simulator and on devices; they do not copy the library into each project.

Controls are engine display groups. Position, transforms, visibility, ordering, and removal use engine behavior. A control's content group contains its children. Removing a containing scene/group disposes its controls through finalization.

Available controls

Panels, labels, buttons, checkboxes, toggles, radio groups, edits, scroll views, lists, sliders, and progress indicators are supplied. Callbacks receive an event whose target is the control. Programmatic property changes update the display without reporting a user action.

Lists are ordinary scrollable rows for mobile-sized collections, not virtualized desktop data grids.

Text input

An unfocused edit is engine-rendered. While focused, it uses a borderless native text field or text box within its skinned frame. That preserves the phone's keyboard, composition, selection, and clipboard behavior.

Native editors render above the canvas. Call ui.blur() before showing an overlay over an active edit. Scrolling or another control interaction also ends editing.

Skinning and placement

Choose the supplied artwork with:

ui.setSkin(require("nexus.ui.skins.artwork"))

Set the skin before creating controls. Existing controls can receive a new skin property. Skin tables provide colors, fonts, padding, backgrounds, and selected/focused/pressed/disabled states.

Backgrounds can use shapes or nine-slice images. Slices stretch the body while retaining borders; they do not automatically mask children. The engine's viewport/container mechanisms provide scrolling clips.

ui.split(rect, ratio, gap, vertical) computes two initial rectangles. Reapply it when the application needs another arrangement; it does not install a separate desktop-style layout engine.

Examples and platforms

The control gallery and customer form show skins, touch controls, and persistence. The control reference lists properties, callbacks, native-editor behavior, and skin options.

Install Android development and emulator components to exercise phone behavior. Desktop simulation does not validate touch or IME behavior. iOS remains unverified here; Linux native editing has known limitations.

Lua construction is the current developer API. A Nexus Script UI overlay is not part of this library.

Packaging Windows applications

The simulator's Windows Build Setup dialog provides an Architecture choice: Win32 (x86) or Win64 (x64). The choice is saved per project and is independent of the simulator's own architecture. Existing projects default to Win32. Output folders use .Win32 or .Win64 so building one does not overwrite the other. Both targets retain the existing Windows build.settings conventions, including excludeFiles.win32 and Icon-win32.ico.

The Windows CoronaBuilder parameters also accept architecture with x86 or x64; omitting it preserves Win32 output. Native plugins must match the selected application architecture. Plugin collection requests win32 or win64 accordingly; Win64 does not fall back to Win32 native plugins.

The added x64 application configurations are Release configurations, matching the existing x64 simulator and dependency configurations. Existing Win32 Debug configurations remain available.