WsPopUpMenu:
Filter:
WsGUI/Classes (extension) | GUI > WsGUI | Extensions

WsPopUpMenu
ExtensionExtension

A pop-up menu for WsGUI

Description

A pop-up menu for WsGUI.

Class Methods

.new

Create new instance and add it to the window immediately.

.init

Create new instance without adding it to the window. Use this when using WsLayout.

Arguments:

wsWindow

An instance of WsWindow

bounds

A Rect specifying the size of the widget.

NOTE: Currently a relative measurement is used: 1 for full window width, 1 for full window height, e.g. Rect(0, 0, 1, 1) would occupy whole window.

NOTE: Because of a bug or peculiarity of certain browsers - the size of the menu (and font to some extent) will not have proper height unless you specify background color

Returns:

an instance of the widget

Instance Methods

.item

Get current menu's item text (String).

NOTE: Setting the item using a String is not currently implemented

.items

Get/set all items of the menu.

Arguments:

itemArr

Array of strings, setting contents of the menu.

Returns:

current items

.action

Gets or sets function to be evaluated when the the item is chosen.

Arguments:

function

Any object to set as default action, usually a Function. It is passed the current instance.

.value

Sets the current item. Does not trigger the action.

Arguments:

val

An integer setting the current menu item.

.valueAction

Sets the current item.

Arguments:

val

An integer setting the current menu item.

.background

Arguments:

color

Background color of the widget. Should be an instance of a Color.

Returns:

current color

.stringColor

Arguments:

color

Text color of the widget. Should be an instance of a Color.

Returns:

current color

Examples