Skip to main content

addPanelToEvent()

Adds a host-built panel to the SDK's tab strip.

Syntax​

accepted = m.maestro.callFunc("addPanelToEvent", {
node: panel
panelType: panel.panelType
title: panel.title
iconUri: panel.callFunc("stagedIconUri")
order: panel.order
})

Parameters​

ParameterTypeDescription
noderoSGNodeThe panel node. Must extend MaestroCustomPanel (the SDK checks for a panelType field).
panelTypestringUnique identifier: letters, digits and _ only. Must not be a type the SDK builds (HelloWorld, EmptyView, a type in the page config) or a reserved name. Used as the node's id, the tab key, and the analytics type (e2).
titlestringThe tab label. Also the analytics panel name (e4).
iconUristring(optional) The tab icon URI. Stage a pkg:/ path with stagedIconUri() first.
orderinteger(optional) Tab position: 0 is first. -1 or past the end goes after the SDK's tabs (default).

Returns​

boolean: true when the panel was accepted; false when it was rejected. A rejected add logs addPanelToEvent rejected - <reason> and reports { message, panelType } on errorInformation. The reasons are listed in Custom panels.

Example​

' Maestro.brs: call before or after config, both work
sub addMyStatsPanel()
panel = createObject("roSGNode", "MyStatsPanel") ' your component, extends MaestroCustomPanel

accepted = m.maestro.callFunc("addPanelToEvent", {
node: panel
panelType: panel.panelType
title: panel.title
iconUri: panel.callFunc("stagedIconUri")
order: panel.order
})
if not accepted then print "Custom panel rejected: "; m.maestro.errorInformation.message
end sub

Notes​

  • Call addPanelToEvent before or after config: either order works. The panel is mounted on the next panel build when called before the config lands, or immediately when called after.
  • An add after the build rebuilds the tab strip and sends rendered:channels on onSDKEvent again; panelsBuilt is not set again.
  • Calling with the same panelType again updates the tab if it is the same node, or replaces the panel with the new one (focus returns to the tab bar first).
  • Use removePanelFromEvent to take the panel out without destroying the SDK.
  • The pkg:/ icon path does not resolve inside the SDK's component library. Call stagedIconUri() on the node to copy it to tmp:/ and pass that path instead.
  • For the full contract, lifecycle and analytics of host-built panels, see Custom panels.