PopUpMenu

PopUpSetItem

Replace an item at an existing position in the menu

Syntax

Signature
xBool       PopUpSetItem( PopUpMenu *popUp, int position, MenuItem *item );

Arguments

popUp the pop-up 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 menu takes ownership of the replacement and releases the old 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 `PopUpSelect()` to choose another position or clear the selection.

See also