PopupMenu

Displays a user-defined, context-style popup menu. The popup menu can appear almost anywhere. And, it can be dismissed by either clicking the left or right mouse buttons.

Syntax

rhinoscriptsyntax.PopupMenu (items, modes=None, point=None, view=None)

rhinoscript.userinterface.PopupMenu (items, modes=None, point=None, view=None)

Parameters

items

Required.  List or Tuple of strings representing the menu items. An empty string, or "", will create a menu separator item.

modes

Optional.  List or Tuple of numbers identifying the display mode of the corresponding menu items. If omitted, all menu items are enabled. Note, display modes are ignored for menu separators. The display modes are a follows:

0

The menu item is enabled.

1

The menu item is disabled.

2

The menu item is checked.

3

The menu item is disabled and checked.

point

Optional.  A 3D point where the menu item is to appear. If omitted, the menu item will appear at the current cursor position.

view

Optional.  String.  If point is specified, then view is the view in which the menu is to appear. If point is specified but view is omitted, then the menu will be displayed in the active view.

Returns

Number

The index of the menu item that was picked.

Number

-1 if no menu item is picked.

Example

import rhinoscriptsyntax as rs

items = "Line", "", "Circle", "Arc"

modes = 2,0,0,0

result = rs.PopupMenu(items, modes)

if result>=0: rs.MessageBox(items[result])