PopUpMenu

PopUpNew

Create a closed pop-up menu with no items

Syntax

Signature
PopUpMenu  *PopUpNew( int top, int left, int bottom, int right );

Arguments

top the top screen row. NIL derives it from bottom or centers the menu vertically when both are NIL.

left the left screen column. NIL derives it from right or centers the menu horizontally when both are NIL.

bottom the bottom screen row to use when top is NIL. Use NIL to leave the bottom edge unspecified.

right the right screen column to use when left is NIL. Use NIL to leave the right edge unspecified.

Return value

The new PopUpMenu object. Release it with PopUpFree().

Description

Include xdev-wtui-classes.h. Add items with `PopUpAddItem()` and show the menu with `PopUpOpen()`. The item count sets the height, the widest item sets the width, and the frame uses one cell on each side. Placement calculates the final bottom and right edges.

The default frame combines `B_SINGLE` and `SEPARATOR_SINGLE`. The constructor chooses the colors from the current `SetColor()` setting. See `PopUpSetColorSpec()` for the order and defaults.

When a menu item takes ownership of this menu through `MenuItemNewO()` or `MenuItemSetPopUp()`, freeing the item also frees the menu. The C methods for adding items, opening the menu and changing the selection return a logical result so the caller can check success directly. The corresponding xBase methods return the object.

See also