--- title: UIX callbacks and the top-menu limit summary: Subscribe to a third-party UIX hook and account for X4's shared icon row. section: ui kind: guide status: reference updated: 2026-10-27 tags: ["X4","modding","ui","hooks","and","top","menu"] sources: ["https://chemodun.github.io/x4/modding-support/ui-modding/uix-callbacks/","https://chemodun.github.io/x4/modding-support/ui-modding/top-menu-entries/","https://github.com/kuertee/x4-mod-ui-extensions"] --- ## UIX is a separate dependency kuertee's UI Extensions and HUD adds dispatch points to standard menus. Its `menu.registerCallback` and `Helper.registerCallback` mechanism must not be assumed in vanilla. UIX has its own version history: a hook in the 9.x line need not exist in 8.x. ## A subscription example Run this fragment after UIX and `MapMenu` are ready: ```lua local menu = Helper.getMenu("MapMenu") if menu and type(menu.registerCallback) == "function" then menu.registerCallback("createPropertyOwned_on_start", function(config) DebugError("[WIKI] owned-property list is being built") end, "wiki_ui_demo") end ``` **When and what it prints:** reaching this dispatch point while building the map's owned-property list produces `[WIKI] owned-property list is being built`. The example adds no button and changes no property. It does not assert a structure for `config`, which the handler does not read. Remove only your subscription during the appropriate cleanup phase: ```lua menu.deregisterCallback("createPropertyOwned_on_start", nil, "wiki_ui_demo") ``` This is a separate cleanup step, not code to run immediately after registration. It also requires the ready `menu` table with that method. ## Arguments and return values Read a callback's arguments separately from how its return is used. Events may discard returns; overrides may choose the last answer, pass it through a chain or stop dispatch. A shared `registerCallback` name does not establish one contract for all hooks. The source provides registration, holder, aggregation and per-release availability cards. ## The shared icon row Several full-screen menus use `Helper.topLevelMenus`. The source explains that `Helper.maxTableCols == 13` allows 11 visible entries because two columns are reserved. Count entries passing `Helper.checkTopLevelConditions`, not merely list length. Versions 8.00/9.00 have `Helper.topLevelConfig.scrolling`. A custom icon needs overflow handling, recounting when conditions change and ownership-aware cleanup. Do not disable scrolling another mod requested. The source details the coordination algorithm. ## Compatibility checks Check exact X4/UIX versions, initialization timing, repeated map opening, deregistration and several UI mods together. A local syntax check does not establish an in-game callback. These fragments were not run in X4. Continue with [shared UI APIs](wiki:ui-settings), [custom windows](wiki:create-ui) and [Lua/MD](wiki:md-lua-bridge).