Blitz3D+ Guides

Native UI documents

Extended Windows programs can load reusable .ui forms containing native controls, logical layouts, fonts and images. LoadNativeUI returns a hidden window. FindNativeGadget looks up stable IDs; configure your application and then ShowNativeUI explicitly shows it.

ui = LoadNativeUI("workbench.ui")
If ui = 0 Then RuntimeError NativeUIError()
apply = FindNativeGadget(ui,"apply")
ShowNativeUI ui
Repeat
    event = WaitEvent()
    If event = $803 And EventSource() = ui Then Exit
    If event = $401 And EventSource() = apply Then SetGadgetText apply,"Applied"
Forever
FreeNativeUI ui

The sample samples/native-ui/NativeUI.bb includes a working form, file requester and application-owned 3D canvas. Run it in Extended mode. Use NativeGadgetID$(ui,EventSource()) to dispatch by name. NativeCanvasRole$ identifies inert canvas roles; application code supplies worlds, cameras and event handling.

A document has format blitz3d.ui, version 1, a unique id, assets and definition.controls. Each control has an id, kind, rect [x,y,width,height], and parent except the single root window. Layout uses SetGadgetLayout modes. Fonts and images use stable local IDs. The reader validates bounds, types, hierarchy and dependencies. Neither callbacks nor runtime handles are serialized. Construction failure returns 0 with NativeUIError and releases provisional controls.

Free application worlds before FreeNativeUI. FreeGadget on the root also releases the UI. Use b3dworldc --export with the sample export.json plan to collect images and application files for relocation.

For editor steps and F1 help, see the World Editor User Guide.