Panel#
Panel
A container for user interface elements. Added to a Canvas or another panel.
A Panel object is passed and returned as its identifier, a number. A path that acts on
an object takes it as (id).
- GET /ui/panel/(id)/rect-transform#
The rect transform for the UI object.
- Parameters:
id – The identifier of the Panel object.
- Response JSON Object:
value (UI.RectTransform)
- GET /ui/panel/(id)/layout-element#
How much space the UI object asks a layout for.
Note
Only has an effect when the object is in a panel that has a layout. A canvas is not inside a layout and does not have one.
- Parameters:
id – The identifier of the Panel object.
- Response JSON Object:
value (UI.LayoutElement)
- GET /ui/panel/(id)/style#
How the background of the panel is drawn. A box is the frame to group related controls in, and is how a group box is made.
- Parameters:
id – The identifier of the Panel object.
- Response JSON Object:
value (UI.PanelStyle)
- PUT /ui/panel/(id)/style#
How the background of the panel is drawn. A box is the frame to group related controls in, and is how a group box is made.
- Parameters:
id – The identifier of the Panel object.
- Request JSON Object:
value (UI.PanelStyle) – The new value.
- GET /ui/panel/(id)/color#
The color the background of the panel is tinted with.
Note
Has no effect while the style of the panel is
"none", as the panel is then not drawn at all.- Parameters:
id – The identifier of the Panel object.
- Response JSON Object:
value (StdLib.ColorRGBA)
- PUT /ui/panel/(id)/color#
The color the background of the panel is tinted with.
Note
Has no effect while the style of the panel is
"none", as the panel is then not drawn at all.- Parameters:
id – The identifier of the Panel object.
- Request JSON Object:
value (StdLib.ColorRGBA) – The new value.
- GET /ui/panel/(id)/draggable#
Whether the user can move the panel by dragging it.
Note
Dragging anywhere on the panel moves it, including over the elements it contains, unless one of them takes the pointer for itself. Give a panel a title bar of its own if only part of it should move it. A panel whose style is
"none"is not drawn, so it takes no pointer events of its own and can only be dragged by the elements it contains.- Parameters:
id – The identifier of the Panel object.
- Response JSON Object:
value (bool)
- PUT /ui/panel/(id)/draggable#
Whether the user can move the panel by dragging it.
Note
Dragging anywhere on the panel moves it, including over the elements it contains, unless one of them takes the pointer for itself. Give a panel a title bar of its own if only part of it should move it. A panel whose style is
"none"is not drawn, so it takes no pointer events of its own and can only be dragged by the elements it contains.- Parameters:
id – The identifier of the Panel object.
- Request JSON Object:
value (bool) – The new value.
- GET /ui/panel/(id)/visible#
Whether the UI object is visible.
Note
This is the object’s own setting, which is what it was last set to. An object is only drawn when everything it is inside is visible as well, so an interface can be built with its parts visible, inside a panel that is not, and shown all at once by making that panel visible.
- Parameters:
id – The identifier of the Panel object.
- Response JSON Object:
value (bool)
- PUT /ui/panel/(id)/visible#
Whether the UI object is visible.
Note
This is the object’s own setting, which is what it was last set to. An object is only drawn when everything it is inside is visible as well, so an interface can be built with its parts visible, inside a panel that is not, and shown all at once by making that panel visible.
- Parameters:
id – The identifier of the Panel object.
- Request JSON Object:
value (bool) – The new value.
- POST /ui/panel/(id)/add-panel#
Create a panel within this object.
- Parameters:
id – The identifier of the Panel object.
- Request JSON Object:
visible (bool) – Whether the new panel is visible. Optional, defaults to
true.
- Response JSON Object:
value (UI.Panel)
- POST /ui/panel/(id)/add-text#
Add text to this object.
- Parameters:
id – The identifier of the Panel object.
- Request JSON Object:
content (string) – The text.
visible (bool) – Whether the text is visible. Optional, defaults to
true.
- Response JSON Object:
value (UI.Text)
- POST /ui/panel/(id)/add-input-field#
Add an input field to this object.
- Parameters:
id – The identifier of the Panel object.
- Request JSON Object:
visible (bool) – Whether the input field is visible. Optional, defaults to
true.
- Response JSON Object:
value (UI.InputField)
- POST /ui/panel/(id)/add-button#
Add a button to this object.
- Parameters:
id – The identifier of the Panel object.
- Request JSON Object:
content (string) – The label for the button.
visible (bool) – Whether the button is visible. Optional, defaults to
true.
- Response JSON Object:
value (UI.Button)
- POST /ui/panel/(id)/add-toggle#
Add a toggle to this object.
- Parameters:
id – The identifier of the Panel object.
- Request JSON Object:
content (string) – The label for the toggle.
visible (bool) – Whether the toggle is visible. Optional, defaults to
true.
- Response JSON Object:
value (UI.Toggle)
- POST /ui/panel/(id)/add-toggle-group#
Add a toggle group to this object, to make a set of toggles into radio buttons.
Note
The group is not drawn and does not take up any space. The toggles that belong to it can be added anywhere.
- Parameters:
id – The identifier of the Panel object.
- Response JSON Object:
value (UI.ToggleGroup)
- POST /ui/panel/(id)/add-slider#
Add a slider to this object.
- Parameters:
id – The identifier of the Panel object.
- Request JSON Object:
vertical (bool) – Whether the slider runs from bottom to top, rather than from left to right. Optional, defaults to
false.visible (bool) – Whether the slider is visible. Optional, defaults to
true.
- Response JSON Object:
value (UI.Slider)
- POST /ui/panel/(id)/add-dropdown#
Add a dropdown to this object.
- Parameters:
id – The identifier of the Panel object.
- Request JSON Object:
visible (bool) – Whether the dropdown is visible. Optional, defaults to
true.
- Response JSON Object:
value (UI.Dropdown)
- POST /ui/panel/(id)/add-image#
Add an image to this object.
- Parameters:
id – The identifier of the Panel object.
- Request JSON Object:
visible (bool) – Whether the image is visible. Optional, defaults to
true.
- Response JSON Object:
value (UI.Image)
- POST /ui/panel/(id)/add-scroll-view#
Add a scroll view to this object.
- Parameters:
id – The identifier of the Panel object.
- Request JSON Object:
visible (bool) – Whether the scroll view is visible. Optional, defaults to
true.
- Response JSON Object:
value (UI.ScrollView)
- GET /ui/panel/(id)/layout#
The layout that arranges the elements of the panel, or
nullif they are positioned by hand.- Parameters:
id – The identifier of the Panel object.
- Response JSON Object:
value (UI.Layout?)
- POST /ui/panel/(id)/add-horizontal-layout#
Arrange the elements of the panel in a row.
- Parameters:
id – The identifier of the Panel object.
- Response JSON Object:
value (UI.Layout)
- POST /ui/panel/(id)/add-vertical-layout#
Arrange the elements of the panel in a column.
- Parameters:
id – The identifier of the Panel object.
- Response JSON Object:
value (UI.Layout)
- POST /ui/panel/(id)/add-grid-layout#
Arrange the elements of the panel in a grid of equally sized cells.
Note
The number of columns follows from the size of the panel and the size of a cell. Use
GET /ui/layout/(id)/constraintto fix it instead.- Parameters:
id – The identifier of the Panel object.
- Response JSON Object:
value (UI.Layout)
- GET /ui/panel/(id)/size-fitter#
Sizes the panel to fit what it contains.
Note
Both directions start out unconstrained, which leaves the size of the panel alone.
- Parameters:
id – The identifier of the Panel object.
- Response JSON Object:
value (UI.SizeFitter)
- POST /ui/panel/(id)/bring-to-front#
Draw the panel in front of the other elements beside it. Elements are drawn in the order they were added, so of two overlapping panels the newer hides part of the older until the older is brought to the front.
Note
A draggable panel also brings itself to the front when the user starts dragging it, the way a window comes to the front when it is clicked.
- Parameters:
id – The identifier of the Panel object.
- POST /ui/panel/(id)/remove#
Remove the UI object.
- Parameters:
id – The identifier of the Panel object.
PanelStyle
How the background of a panel is drawn.
Passed and returned as the name of one of its values:
"window"As a window, the heavier of the two frames the game uses.
"box"As a box, the lighter frame the game groups related controls in.
"none"Not drawn at all, leaving whatever is behind the panel showing through.