s&
About
The Project
info
About s&box
map
Roadmap
monitoring
Metrics
Engine startup and usage numbers
Updates
newspaper
Latest News
published_with_changes
Changes
Release-by-release changelog
Games
Browse Games
Discover Games
gamejams
live now
Game Jam III
Ends
Fri 25 Sep
Theme
One More Round
The jam is running. Build something, or play the entries.
£
50,000
prizepool
View the jam
Workshop
Playable
sports_esports
Games
Standalone games and gamemodes
Assets
landscape
Maps
view_in_ar
Models
texture
Materials
apparel
Clothing
apps
Everything
Every asset type in one list
Forum
Learn
Documentation
rocket_launch
Getting Started
docs
Documentation
api
API Reference
Resources
school
Tutorials
manage_search
Code Search
input
Log in with Steam
chevron_left
Change Language
简体中文
English
Русский
Español
Português-Brasil
Deutsch
日本語
Français
Polski
Türkçe
한국어
Pirate
Italiano
ไทย
繁體中文
Українська
Čeština
Nederlands
Magyar
Dansk
Suomi
Svenska
Norsk
Ελληνικά
Română
Български
Tiếng Việt
Bahasa Indonesia
Español-Latinoamérica
العربية
Api
Classes
Menu
chevron_left
Classes
class
Menu
Constructors
functions
Menu
Properties
data_object
Checkable
data_object
Checked
data_object
Clicked
data_object
Enabled
data_object
HasOptions
data_object
Highlighted
data_object
Icon
data_object
IsOpen
data_object
IsSeparator
data_object
Options
data_object
ParentMenu
data_object
RootMenu
data_object
Rows
data_object
Shortcut
data_object
StaysOpen
data_object
Text
data_object
Toggled
Methods
functions
Activate
functions
AddMenu
functions
AddOption
functions
AddSeparator
functions
AddWidget
functions
Clear
functions
Close
functions
FindOption
lock
OnChildAdded
lock
OnClick
functions
OnDeleted
lock
OnMouseMove
lock
OnMouseOut
lock
OnMouseOver
functions
Open
functions
Remove
Menu
One entry in a menu, and the menu it opens. A menu with no options is a plain command; give it options and it becomes a submenu. A root menu with no parent is a context menu, or a heading in a Sandbox.UI.MenuBar.
class
Sandbox.UI
.
account_tree
extends
Panel
Sandbox.Engine
build
Constructors
1
Menu
(
)
data_object
Properties
17
Checkable
bool
Clicking toggles Sandbox.UI.Menu.Checked instead of running Sandbox.UI.Menu.Clicked.
Checked
bool
Shows a check mark in the gutter.
Clicked
Action
Runs when the row is activated.
Enabled
bool
A disabled row is dimmed and does nothing when clicked.
HasOptions
bool
Does this row open a submenu?
Highlighted
Menu
The row with the keyboard or hover highlight, in this menu's list.
Icon
string
Material icon shown in the gutter, before the text.
IsOpen
bool
Whether this menu's options are showing.
IsSeparator
bool
Draws a line between rows instead of a row.
Options
IReadOnlyList`1
The option rows of this menu, in order.
ParentMenu
Menu
The menu this row is an option of. Null for a root menu.
RootMenu
Menu
The top of this menu tree.
Rows
IReadOnlyList`1
Everything the list shows, in order - the options and any other panels added.
Shortcut
string
Shortcut text drawn on the right, like "Ctrl+S". Display only - nothing dispatches it yet.
StaysOpen
bool
Whether the menu stays up after this row is activated. Checkable rows do, so several can be flipped in one go; commands close the menu. Set it to say otherwise.
Text
string
The text shown on the row.
Toggled
Action`1
Runs with the new state when a checkable row is toggled. Setting it makes the row checkable.
functions
Methods
16
Activate
(
)
Do what a click on this row does. A submenu row opens, a checkable row toggles, a command runs and takes the whole menu down with it.
AddMenu
(
text
,
icon
)
Menu
Add a submenu. Same as Sandbox.UI.Menu.AddOption(System.String,System.String,System.Action) without an action.
AddOption
(
text
,
icon
,
action
)
Menu
Add a row. Returns it so you can keep configuring it or add options to it.
AddSeparator
(
)
Menu
Add a line between rows.
AddWidget
(
widget
)
T
Add any panel as a row - a text entry, a slider, a heading. It's shown in the list like an option but the menu leaves it alone.
Clear
(
)
Delete every row.
Close
(
)
Hide this menu's options, and any open submenus.
FindOption
(
text
)
Menu
The first option with this text, or null.
OnChildAdded
(
child
)
A panel nested inside a menu - from Razor, or AddChild - is a row of it, not part of the row itself. It stays hidden in the row until the menu opens and moves it into the list.
OnClick
(
e
)
OnDeleted
(
)
OnMouseMove
(
e
)
OnMouseOut
(
e
)
OnMouseOver
(
e
)
Open
(
source
,
position
,
offset
)
Show this menu's options next to a panel. Use this for context menus and buttons.
Remove
(
row
)
Take a row out without deleting it.
Inheritance
Panel
Menu
people
Log in to reply
You can't reply if you're not logged in. That would be crazy.