TopBarMenu

TopBarSetItem

Replace an item at an existing position in the menu bar

Syntax

Signature
xBool       TopBarSetItem( TopBarMenu *topBar, int position, MenuItem *item );

Arguments

topBar the top bar menu.

position the one-based position of an existing item.

item the replacement item. NULL is invalid.

Return value

T on success, or F if the object is NULL, item is NULL or position is outside the existing item list.

Description

On success the bar takes ownership of the replacement and releases the previous item. If the replacement uses the same submenu, ownership of that submenu passes to the replacement. Passing the item already at that position succeeds without freeing it. The caller retains ownership of a supplied replacement on failure.

Replacement preserves the current position even when the new item is disabled or is a separator. Use `TopBarSelect()` to choose another position or clear the selection.

See also