Controls
Every control you can add to a window, a page, a section, a row or an overlay.
The Explorer searches everything on this page, and the classes of the game too.
WaxContainer
Something controls can be added to: a window, a page, a section, a row or an overlay.
You get one from game.Containers:Around. Below, container stands for one of these.
container:Label(content, options?)
Adds text. It wraps to the container's width. In a row it does not wrap: each line of the text is one line in the label's share of the row, cut short with "..." when it is too long, and shown whole as a tip.
container:Label(content: any, options?: WaxLabelOptions): WaxLabel| Parameter | Type |
|---|---|
content | any |
options (optional) | WaxLabelOptions |
Returns WaxLabel
container:Heading(content)
Adds a bold title line.
container:Heading(content: any): WaxHeading| Parameter | Type |
|---|---|
content | any |
Returns WaxHeading
container:Separator()
Adds a thin dividing line.
container:Separator(): WaxControlReturns WaxControl
container:Spacer(height?)
Adds an empty gap, as tall as the theme's spacing when no height is given.
container:Spacer(height?: number): WaxControl| Parameter | Type |
|---|---|
height (optional) | number |
Returns WaxControl
container:Button(caption?, on_click?, options?)
Adds a button. on_click runs on each click. With an icon and no caption it is an icon button.
container:Button(caption?: string, on_click?: fun(), options?: WaxButtonOptions): WaxButton| Parameter | Type |
|---|---|
caption (optional) | string |
on_click (optional) | fun() |
options (optional) | WaxButtonOptions |
Returns WaxButton
container:Picture(file, options?)
Adds a picture from a .png or .jpg file, in the shape the picture has. With nil for the file it shows nothing until Set is called.
container:Picture(file: string?, options?: WaxPictureOptions): WaxPicture| Parameter | Type | Description |
|---|---|---|
file | string? | The whole path of the file, such as mod.dir .. "/logo.png". |
options (optional) | WaxPictureOptions |
Returns WaxPicture
container:Tile(options)
Adds a card to press: a title, a line of text, small counts and a badge, over a faded picture when it has one.
container:Tile(options: WaxTileOptions): WaxTile| Parameter | Type |
|---|---|
options | WaxTileOptions |
Returns WaxTile
container:Badge(text, options?)
Adds a word or two in a small pill, such as "New" or a tag.
container:Badge(text: string, options?: WaxBadgeOptions): WaxControl| Parameter | Type |
|---|---|
text | string |
options (optional) | WaxBadgeOptions |
Returns WaxControl
container:Stat(caption, value)
Adds a caption with its value under it. Several in a Flow make a line of facts.
container:Stat(caption: string, value: any): WaxStat| Parameter | Type |
|---|---|
caption | string |
value | any |
Returns WaxStat
container:Count(icon, value, options?)
Adds an icon with a number or a word beside it, such as a count of downloads.
container:Count(icon: string, value: any, options?: WaxCountOptions): WaxCount| Parameter | Type | Description |
|---|---|---|
icon | string | The icon's name. The menu's Icons page lists the names. |
value | any | |
options (optional) | WaxCountOptions |
Returns WaxCount
container:Icon(name, options?)
Adds an icon on its own, by name. The menu's Icons page lists the names.
container:Icon(name: string, options?: WaxIconOptions): WaxIcon| Parameter | Type |
|---|---|
name | string |
options (optional) | WaxIconOptions |
Returns WaxIcon
container:Toggle(caption, initial?, on_change?)
Adds a switch. on_change(on) runs when the user flips it.
container:Toggle(caption: string, initial?: boolean, on_change?: fun(on: boolean)): WaxToggle| Parameter | Type |
|---|---|
caption | string |
initial (optional) | boolean |
on_change (optional) | fun(on: boolean) |
Returns WaxToggle
container:Slider(caption, options?, on_change?)
Adds a slider with a read-out. on_change(value) runs while the user drags it.
container:Slider(caption: string, options?: WaxSliderOptions, on_change?: fun(value: number)): WaxSlider| Parameter | Type |
|---|---|
caption | string |
options (optional) | WaxSliderOptions |
on_change (optional) | fun(value: number) |
Returns WaxSlider
container:Input(caption?, options?, on_commit?)
Adds a text box. on_commit(text) runs when Enter is pressed or the box loses focus.
container:Input(caption?: string, options?: WaxInputOptions, on_commit?: fun(text: string)): WaxInput| Parameter | Type |
|---|---|
caption (optional) | string |
options (optional) | WaxInputOptions |
on_commit (optional) | fun(text: string) |
Returns WaxInput
container:Dropdown(caption, choices, selected?, on_change?)
Adds a dropdown that opens in place. on_change(choice) runs when the user picks one. With nil for the caption the dropdown takes the whole width, or its whole share of a row.
container:Dropdown<T>(caption: string?, choices: T[], selected?: T, on_change?: fun(choice: T)): WaxDropdown| Parameter | Type | Description |
|---|---|---|
caption | string? | |
choices | T[] | |
selected (optional) | T | The first choice when omitted. |
on_change (optional) | fun(choice: T) |
Returns WaxDropdown
container:Section(title, options?)
Adds a collapsible card and returns it as a container: section:Button(...), section:Toggle(...) and so on.
container:Section(title: string, options?: WaxSectionOptions): WaxSection| Parameter | Type |
|---|---|
title | string |
options (optional) | WaxSectionOptions |
Returns WaxSection
container:Title(content, description?)
Adds a title for a page or a group of controls: large text, an optional explanation, and a rule under it.
container:Title(content: string, description?: string): WaxTitle| Parameter | Type |
|---|---|
content | string |
description (optional) | string |
Returns WaxTitle
container:Row(options?)
Adds a row. Controls added to the returned container sit side by side and share the width.
container:Row(options?: WaxRowOptions): WaxRow| Parameter | Type |
|---|---|
options (optional) | WaxRowOptions |
Returns WaxRow
container:Color(caption, color?, on_change?)
A colour the user can change.
container:Color(caption: string, color?: string, on_change?: fun(color: string)): WaxColorControl| Parameter | Type | Description |
|---|---|---|
caption | string | |
color (optional) | string | "#rrggbb". White when omitted. |
on_change (optional) | fun(color: string) |
Returns WaxColorControl
container:Grid(options)
Adds a grid for any number of items. It builds only the cells in view, with the make and show functions in options.
container:Grid(options: WaxGridOptions): WaxGrid| Parameter | Type |
|---|---|
options | WaxGridOptions |
Returns WaxGrid
container:Flow(options?)
Adds an area where controls keep their own size and wrap onto new lines. Add them to the returned container.
container:Flow(options?: WaxFlowOptions): WaxRow| Parameter | Type |
|---|---|
options (optional) | WaxFlowOptions |
Returns WaxRow
container:Item(options?, on_click?, on_arrow?)
Adds one line of a list or a tree: an arrow, an icon, a name, a note and a value. In a grid it makes a list of any length.
container:Item(options?: WaxItemOptions, on_click?: fun(), on_arrow?: fun()): WaxItem| Parameter | Type | Description |
|---|---|---|
options (optional) | WaxItemOptions | |
on_click (optional) | fun() | Runs when the line is pressed. |
on_arrow (optional) | fun() | Runs when its arrow is pressed. |
Returns WaxItem
container:Split(options?)
Adds two areas side by side. Add controls to its Left and Right.
container:Split(options?: WaxSplitOptions): WaxSplit| Parameter | Type |
|---|---|
options (optional) | WaxSplitOptions |
Returns WaxSplit
container:Slots(options?)
Adds a block of square cells for pictures, such as items. Give it looks with Set.
container:Slots(options?: WaxSlotsOptions): WaxSlots| Parameter | Type |
|---|---|
options (optional) | WaxSlotsOptions |
Returns WaxSlots
container:Model(options?)
Adds a box that shows a creature or any other skeletal mesh of the game in 3D. Give it what game.Creatures:GetModel gives, or a mesh by its path.
container:Model(options?: WaxModelOptions): WaxModel| Parameter | Type |
|---|---|
options (optional) | WaxModelOptions |
Returns WaxModel
container:Progress(caption, value?, options?)
Adds a progress bar. value is 0..1.
container:Progress(caption: string, value?: number, options?: WaxProgressOptions): WaxProgress| Parameter | Type |
|---|---|
caption | string |
value (optional) | number |
options (optional) | WaxProgressOptions |
Returns WaxProgress
container:Field(name, value?, options?)
Adds a name with a value on the right, for read-outs.
container:Field(name: string, value?: any, options?: WaxFieldOptions): WaxField| Parameter | Type |
|---|---|
name | string |
value (optional) | any |
options (optional) | WaxFieldOptions |
Returns WaxField
container:Keybind(caption, key?, on_change?)
Adds a key the user can rebind by clicking it and pressing a key. on_change(key) gets the engine's key name.
container:Keybind(caption: string, key?: string, on_change?: fun(key: string)): WaxKeybind| Parameter | Type |
|---|---|
caption | string |
key (optional) | string |
on_change (optional) | fun(key: string) |
Returns WaxKeybind
container:Console(options?)
Adds a scrolling list of text lines, such as a log.
container:Console(options?: WaxConsoleOptions): WaxConsole| Parameter | Type |
|---|---|
options (optional) | WaxConsoleOptions |
Returns WaxConsole
WaxControl
What every control has.
You get one from ui.NeedsHost, container:Separator, container:Spacer, container:Badge. Below, control stands for one of these.
| Signal | Handler receives | Description |
|---|---|---|
Changed | depends on the control | Fires when the user changes the control's value. |
control:Destroy()
Removes the control.
control:Destroy()Returns nothing.
control:SetVisible(shown)
Shows or hides the control. A hidden control takes no room.
control:SetVisible(shown: boolean)| Parameter | Type |
|---|---|
shown | boolean |
Returns nothing.
control:SetEnabled(enabled)
Greys the control out and stops it reacting, or makes it usable again.
control:SetEnabled(enabled: boolean)| Parameter | Type |
|---|---|
enabled | boolean |
Returns nothing.
control:SetTip(text)
Help shown while the mouse rests on the control. It needs a part that reports the mouse, which buttons, toggles, sections and key boxes have: for a control without one it answers false and shows nothing. nil or "" takes the tip away.
control:SetTip(text: string?): boolean| Parameter | Type |
|---|---|
text | string? |
Returns boolean (shown)
WaxLabel
A piece of text. It wraps to the width of its container. In a row it is one line: text too long for its share is cut short with "..." and shown whole as a tip while the mouse rests on it.
It can also do everything WaxControl can. You get one from container:Label. Below, label stands for one of these.
label:Set(value)
Replaces the text.
label:Set(value: any)| Parameter | Type |
|---|---|
value | any |
Returns nothing.
label:SetColor(color)
Changes the text colour.
label:SetColor(color: WaxColor)| Parameter | Type |
|---|---|
color | WaxColor |
Returns nothing.
WaxHeading
A bold line of text above a group of controls. It is smaller than a Title and has no rule under it.
It can also do everything WaxControl can. You get one from container:Heading. Below, heading stands for one of these.
heading:Set(value)
Replaces the text.
heading:Set(value: any)| Parameter | Type |
|---|---|
value | any |
Returns nothing.
WaxButton
A button with a caption, an icon, or both. Made with tab = true it is one of a row of tabs.
It can also do everything WaxControl can. You get one from container:Button. Below, button stands for one of these.
| Signal | Handler receives | Description |
|---|---|---|
Activated | nothing | Fires on each click, after on_click. |
Changed | nothing | The same signal as Activated. |
button:SetIcon(name)
Shows another icon on a button that was made with one.
button:SetIcon(name: string)| Parameter | Type |
|---|---|
name | string |
Returns nothing.
button:Spin()
Turns the icon round once.
button:Spin()Returns nothing.
button:SetCaption(text)
Replaces the caption of a button that was made with one.
button:SetCaption(text: any)| Parameter | Type |
|---|---|
text | any |
Returns nothing.
button:SetActive(on)
Shows the button as the chosen one, or not. A tab shows its line. A button with an icon is drawn in its active_color, or in the accent colour when it has none. A button with neither raises an error.
button:SetActive(on: boolean)| Parameter | Type |
|---|---|
on | boolean |
Returns nothing.
button:SetTip(tip)
Changes the help shown while the mouse rests on the button, for a button whose meaning changes. nil takes it away.
button:SetTip(tip: string|table|nil)| Parameter | Type |
|---|---|
tip | string | table | nil |
Returns nothing.
WaxIcon
One icon on its own, shown by its name.
It can also do everything WaxControl can. You get one from container:Icon. Below, icon stands for one of these.
icon:Set(name)
Shows another icon.
icon:Set(name: string)| Parameter | Type |
|---|---|
name | string |
Returns nothing.
WaxToggle
A switch that is on or off, with a caption beside it.
It can also do everything WaxControl can. You get one from container:Toggle. Below, toggle stands for one of these.
| Signal | Handler receives | Description |
|---|---|---|
Changed | on: boolean | Fires when the user flips the switch. |
toggle:Get()
True while the switch is on.
toggle:Get(): booleanReturns boolean
toggle:Set(on, instant?)
Turns the switch on or off without firing Changed.
toggle:Set(on: boolean, instant?: boolean)| Parameter | Type | Description |
|---|---|---|
on | boolean | |
instant (optional) | boolean | True skips the sliding animation, for a switch that is being reused for another row. |
Returns nothing.
toggle:SetCaption(text)
Changes the text beside the switch.
toggle:SetCaption(text: string)| Parameter | Type |
|---|---|
text | string |
Returns nothing.
toggle:Get()
Whether the switch is on.
toggle:Get(): booleanReturns boolean
toggle:Set(on)
Flips the switch from code. Changed does not fire.
toggle:Set(on: boolean)| Parameter | Type |
|---|---|
on | boolean |
Returns nothing.
toggle:SetCaption(text)
toggle:SetCaption(text: string)| Parameter | Type |
|---|---|
text | string |
Returns nothing.
WaxColorControl
A colour selector. It opens a panel with a shade box, a hue bar and the colour as text that can be typed, pasted or copied.
It can also do everything WaxControl can. You get one from container:Color. Below, colorControl stands for one of these.
| Signal | Handler receives | Description |
|---|---|---|
Changed | color: string | Fires with "#rrggbb" on every change, also while the mouse is held. |
Released | color: string | Fires once when the user lets go, or commits a typed colour. Use it for saving. |
colorControl:Get()
The colour as "#rrggbb".
colorControl:Get(): stringReturns string
colorControl:Set(color)
Sets the colour without firing Changed.
colorControl:Set(color: string)| Parameter | Type | Description |
|---|---|---|
color | string | "#rrggbb" |
Returns nothing.
WaxTitle
A page or group title: large text, an optional line under it, and a rule.
It can also do everything WaxControl can. You get one from container:Title. Below, title stands for one of these.
title:Set(content)
Changes the title text.
title:Set(content: any)| Parameter | Type |
|---|---|
content | any |
Returns nothing.
title:SetDescription(description)
Changes the line under the title (only if the title was made with one).
title:SetDescription(description: any)| Parameter | Type |
|---|---|
description | any |
Returns nothing.
WaxSlider
A slider. The number beside it can be clicked and typed into.
It can also do everything WaxControl can. You get one from container:Slider. Below, slider stands for one of these.
| Signal | Handler receives | Description |
|---|---|---|
Changed | value: number | Fires with each new value while the user drags (once, on letting go, with live = false), and when a number is typed. |
Released | value: number | Fires once when the user lets go, for changes too heavy to apply during the drag. |
slider:Get()
The current value.
slider:Get(): numberReturns number
slider:Set(value)
Moves the slider (snapped and kept within its range) without firing Changed.
slider:Set(value: number)| Parameter | Type |
|---|---|
value | number |
Returns nothing.
slider:Get()
The value shown.
slider:Get(): numberReturns number
slider:Set(value)
Moves the slider from code, snapped to its step and kept inside its range. Changed does not fire.
slider:Set(value: number)| Parameter | Type |
|---|---|
value | number |
Returns nothing.
WaxInput
A box the user types text into, with or without a caption.
It can also do everything WaxControl can. You get one from container:Input. Below, input stands for one of these.
| Signal | Handler receives | Description |
|---|---|---|
Changed | text: string | Fires when the text is committed (Enter, or the box losing focus). |
Entered | text: string | Fires only when Enter is pressed, even when the text is the same as last time (for a command line). |
Typed | text: string | Fires on every change to the text while typing. |
input:Get()
The text in the box.
input:Get(): stringReturns string
input:Focus()
Gives the box the keyboard, so the user can type without clicking it.
input:Focus()Returns nothing.
input:HasFocus()
True while the box has the keyboard.
input:HasFocus(): booleanReturns boolean
input:SetGhost(text)
Shows greyed text after what is typed, such as the rest of a suggested word. Only a box made with mono = true shows it.
input:SetGhost(text: string)| Parameter | Type | Description |
|---|---|---|
text | string | Empty to show nothing. |
Returns nothing.
input:Set(text)
Replaces the text without firing Changed.
input:Set(text: any)| Parameter | Type |
|---|---|
text | any |
Returns nothing.
input:SetHint(hint)
Changes the greyed text shown while the box is empty.
input:SetHint(hint: string)| Parameter | Type |
|---|---|
hint | string |
Returns nothing.
input:Get()
The text in the box.
input:Get(): stringReturns string
input:Set(text)
Puts text in the box from code. Changed does not fire.
input:Set(text: string)| Parameter | Type |
|---|---|
text | string |
Returns nothing.
WaxDropdown
A dropdown opens in place under its header. The chosen row is highlighted, and only one list is open at a time. The header is always one line: a choice too long for it ends in "..." there and is whole in the list.
It can also do everything WaxControl can. You get one from container:Dropdown. Below, dropdown stands for one of these.
| Signal | Handler receives | Description |
|---|---|---|
Changed | choice: any | Fires when the user picks a choice. |
dropdown:Get()
The selected choice.
dropdown:Get(): anyReturns any
dropdown:Set(choice)
Selects a choice without firing Changed.
dropdown:Set(choice: any)| Parameter | Type |
|---|---|
choice | any |
Returns nothing.
dropdown:Get()
The chosen entry.
dropdown:Get(): anyReturns any
dropdown:Set(choice)
Chooses an entry from code. Changed does not fire.
dropdown:Set(choice: any)| Parameter | Type |
|---|---|
choice | any |
Returns nothing.
WaxSection
A collapsible card. It is a container for controls.
It can also do everything WaxContainer can. You get one from container:Section. Below, section stands for one of these.
| Property | Type | Description |
|---|---|---|
control | WaxControl | The card itself, for Destroy, SetVisible and SetEnabled. |
section:SetOpen(open)
Expands or collapses the section.
section:SetOpen(open: boolean)| Parameter | Type |
|---|---|
open | boolean |
Returns nothing.
section:IsOpen()
True while the section is expanded.
section:IsOpen(): booleanReturns boolean
WaxRow
A container whose controls sit side by side.
It can also do everything WaxContainer can. You get one from container:Row, container:Flow.
| Property | Type | Description |
|---|---|---|
control | WaxControl | The row itself, for Destroy, SetVisible and SetEnabled. |
WaxProgress
A progress bar, with its caption and the value as a percentage on a line above it.
It can also do everything WaxControl can. You get one from container:Progress. Below, progress stands for one of these.
progress:Get()
The current value, 0..1.
progress:Get(): numberReturns number
progress:Set(value)
Moves the bar to a value of 0..1.
progress:Set(value: number)| Parameter | Type |
|---|---|
value | number |
Returns nothing.
progress:SetColor(color)
Changes the colour of the filled part.
progress:SetColor(color: WaxColor)| Parameter | Type |
|---|---|
color | WaxColor |
Returns nothing.
WaxField
A name with a value at the right, for read-outs. The user cannot change it.
It can also do everything WaxControl can. You get one from container:Field. Below, field stands for one of these.
field:Set(value)
Replaces the value.
field:Set(value: any)| Parameter | Type |
|---|---|
value | any |
Returns nothing.
field:SetColor(color)
Changes the colour of the value.
field:SetColor(color: WaxColor)| Parameter | Type |
|---|---|
color | WaxColor |
Returns nothing.
WaxKeybind
A key the user can change: after a click on it, the next key pressed becomes the key. Escape leaves it as it was.
It can also do everything WaxControl can. You get one from container:Keybind. Below, keybind stands for one of these.
| Signal | Handler receives | Description |
|---|---|---|
Changed | key: string | Fires with the engine's name of the key the user pressed. |
keybind:Get()
The key's engine name, or nil when none is set.
keybind:Get(): string?Returns string?
keybind:Set(key)
Sets the key without firing Changed.
keybind:Set(key: string?)| Parameter | Type |
|---|---|
key | string? |
Returns nothing.
keybind:Get()
The key shown, or nil for none.
keybind:Get(): string?Returns string?
keybind:Set(key)
Shows another key from code. Changed does not fire.
keybind:Set(key: string?)| Parameter | Type |
|---|---|
key | string? |
Returns nothing.
WaxConsole
A log: coloured lines the user can select across (drag, Ctrl+A) and copy (Ctrl+C).
It can also do everything WaxControl can. You get one from container:Console. Below, console stands for one of these.
console:GetText()
Everything being shown, as one text (for ui.Copy).
console:GetText(): stringReturns string
console:SetLines(lines)
Shows these lines, or the last max of them.
console:SetLines(lines: WaxConsoleLine[])| Parameter | Type |
|---|---|
lines | WaxConsoleLine[] |
Returns nothing.
console:SetFollow(on)
Turns scrolling to the newest line on every SetLines on or off. It starts on.
console:SetFollow(on: boolean)| Parameter | Type |
|---|---|
on | boolean |
Returns nothing.
WaxPicture
A picture from a file.
It can also do everything WaxControl can. You get one from container:Picture. Below, picture stands for one of these.
picture:Set(file)
Shows another picture file. Returns false and the reason when the file is not a PNG or JPG picture the game can read.
picture:Set(file: string): boolean, string?| Parameter | Type | Description |
|---|---|---|
file | string | The whole path of a .png or .jpg file. |
Returns
boolean(shown)string?(why)
picture:SetSelected(on)
Draws or removes the line around a picture that was made with on_click.
picture:SetSelected(on: boolean)| Parameter | Type |
|---|---|
on | boolean |
Returns nothing.
WaxTile
A card to press.
It can also do everything WaxControl can. You get one from container:Tile. Below, tile stands for one of these.
tile:SetPicture(file)
Puts a picture behind the card, faded and cut to the card's shape. Returns false and the reason when the file cannot be read.
tile:SetPicture(file: string): boolean, string?| Parameter | Type | Description |
|---|---|---|
file | string | The whole path of a .png or .jpg file. |
Returns
boolean(shown)string?(why)
WaxStat
A caption with its value under it.
It can also do everything WaxControl can. You get one from container:Stat. Below, stat stands for one of these.
stat:Set(value)
Changes the value.
stat:Set(value: any)| Parameter | Type |
|---|---|
value | any |
Returns nothing.
WaxCount
An icon with a number or a word beside it.
It can also do everything WaxControl can. You get one from container:Count. Below, count stands for one of these.
count:Set(value)
Changes the value.
count:Set(value: any)| Parameter | Type |
|---|---|
value | any |
Returns nothing.
WaxGrid
A grid for any number of items: only the cells in view exist, and they are reused as it scrolls. It follows its scrolling while the menu is open, so it belongs in a window, not in an overlay.
It can also do everything WaxControl can. You get one from container:Grid. Below, grid stands for one of these.
grid:SetItems(items, keep?)
Shows another list, from the top. With keep it stays where it is scrolled to.
grid:SetItems(items: any[], keep?: boolean)| Parameter | Type |
|---|---|
items | any[] |
keep (optional) | boolean |
Returns nothing.
grid:Refresh()
Shows every cell again, after the items themselves changed.
grid:Refresh()Returns nothing.
grid:Count()
How many items the grid has.
grid:Count(): integerReturns integer
WaxItem
One line of a list or a tree.
It can also do everything WaxControl can. You get one from container:Item. Below, item stands for one of these.
| Signal | Handler receives | Description |
|---|---|---|
Activated | nothing | Fires when the line is pressed. |
Toggled | nothing | Fires when its arrow is pressed. |
item:Set(look)
Describes the whole line again. Only what changed is redrawn, so it is cheap to call for a line that is reused.
item:Set(look: WaxItemLook)| Parameter | Type |
|---|---|
look | WaxItemLook |
Returns nothing.
item:SetSelected(selected)
Marks the line as the picked one, or takes the mark off. Nothing else of the line changes.
item:SetSelected(selected: boolean)| Parameter | Type |
|---|---|
selected | boolean |
Returns nothing.
item:Get()
What the line is showing.
item:Get(): WaxItemLookReturns WaxItemLook
WaxSplit
Two areas side by side with a divider the user can drag. With too little room for both, one shows at a time.
It can also do everything WaxControl can. You get one from container:Split. Below, split stands for one of these.
| Property | Type | Description |
|---|---|---|
Left | WaxContainer | Something controls can be added to: a window, a page, a section, a row or an overlay. |
Right | WaxContainer | Something controls can be added to: a window, a page, a section, a row or an overlay. |
| Signal | Handler receives | Description |
|---|---|---|
Changed | single: boolean | Fires when it goes from two areas to one, or back. |
split:IsSingle()
True while there is only room for one area.
split:IsSingle(): booleanReturns boolean
split:Show(which)
Which area shows while there is only room for one.
split:Show(which: "left"|"right")| Parameter | Type |
|---|---|
which | "left" | "right" |
Returns nothing.
split:Shown()
The area that shows while there is only room for one. It is "left" until Show picks the other.
split:Shown(): "left"|"right"Returns "left" | "right"
split:SetShare(share)
Sets the left area's part of the width, from 0.05 to 0.95. Neither area is drawn narrower than least.
split:SetShare(share: number)| Parameter | Type |
|---|---|
share | number |
Returns nothing.
split:GetShare()
The left area's part of the width, as SetShare or the user's drag of the divider last left it.
split:GetShare(): numberReturns number
WaxSlots
A block of square cells that each show a picture, a count and a mark. Switched off with SetEnabled(false), its cells take no click, are not under the mouse for ui.Hovered, and show the arrow in place of the hand.
It can also do everything WaxControl can. You get one from ui.Hovered, container:Slots. Below, slots stands for one of these.
| Signal | Handler receives | Description |
|---|---|---|
Activated | value: any, index: integer, look: WaxSlotLook | A cell was clicked. |
RightClicked | value: any, index: integer, look: WaxSlotLook | |
MiddleClicked | value: any, index: integer, look: WaxSlotLook | |
Hovered | value: any, index: integer, look: WaxSlotLook? | The mouse came over a cell. |
slots:Set(looks)
Shows these looks, the first in the first cell. Cells past the end of the list are empty.
slots:Set(looks: WaxSlotLook[])| Parameter | Type |
|---|---|
looks | WaxSlotLook[] |
Returns nothing.
slots:SetLook(index, look)
Changes one cell.
slots:SetLook(index: integer, look: WaxSlotLook?)| Parameter | Type |
|---|---|
index | integer |
look | WaxSlotLook? |
Returns nothing.
slots:GetLook(index)
The look a cell was last given, or nil for an empty cell.
slots:GetLook(index: integer): WaxSlotLook?| Parameter | Type |
|---|---|
index | integer |
Returns WaxSlotLook?
slots:Capacity()
How many cells it has.
slots:Capacity(): integerReturns integer
slots:SetLayout(columns, size?)
Changes how many cells stand in a row and how large a cell is. The cells that exist are kept and put in their new rows, and missing ones are made over the next frames. What a cell shows stays; set the looks again if fewer fit.
slots:SetLayout(columns: integer, size?: number)| Parameter | Type | Description |
|---|---|---|
columns | integer | |
size (optional) | number | The side of one cell. As it was when left out. |
Returns nothing.
slots:Ready()
True once every cell exists. Cells are made a few a frame.
slots:Ready(): booleanReturns boolean
WaxLabelOptions
Used by container:Label.
| Option | Type | Description |
|---|---|---|
dim | boolean | Uses the theme's secondary text colour. |
color | WaxColor | A colour in the linear form the engine uses. Make one with ui.Color. |
size | number | |
face | string | Typeface of the "ui" family: "Book", "Medium", "Bold" ... |
family | WaxFontFamily | "ui" (the game's own interface font) when omitted. |
align | "center" | "right" | Where the text sits in its line. Left when omitted. |
weight | number | In a row: its share of the width beside the other controls. 1 when omitted. |
WaxButtonOptions
Used by container:Button.
| Option | Type | Description |
|---|---|---|
active_color | table | A theme colour the icon and the caption are drawn in while SetActive(true) holds. |
bare | boolean | Draws no box behind the button, only its icon and caption, with a faint box while the mouse is on it. |
primary | boolean | Draws the button in the accent colour. |
stretch | boolean | A button with a caption is as wide as its container. False keeps it as wide as its caption. An icon-only button is small unless this is true. |
icon | string | Icon name shown before the caption. The menu's Icons page lists the names. |
spin | boolean | The icon turns round once on every click, to show that something has started. |
tab | boolean | Makes it one of a row of tabs: SetActive marks the chosen one. |
tip | string | table | A line of help shown beside the mouse once it has rested on the button. Give one to every button that is only an icon. A table is { title = "...", lines = { "more" } }. |
size | number | For a button that is an icon only: the side of the square it is drawn as. Left out, it is as tall as the other buttons. |
WaxIconOptions
Used by container:Icon.
| Option | Type | Description |
|---|---|---|
size | number | Default 20. |
color | WaxColor | The theme's text colour when omitted. |
WaxSliderOptions
Used by container:Slider.
| Option | Type | Description |
|---|---|---|
min | number | Default 0. |
max | number | Default 1. |
value | number | The starting value. min when omitted. |
step | number | Values snap to this step, counted from min. |
format | string | string.format pattern for the read-out. "%.2f" when omitted, or "%d" with a step of 1 or more. |
stacked | boolean | True puts the caption above the track, false beside it. When omitted, the room available decides. |
live | boolean | False reports the value once, when the mouse lets go, for changes too heavy to make while dragging. True when omitted. |
WaxInputOptions
Used by container:Input.
| Option | Type | Description |
|---|---|---|
text | string | The starting text. |
hint | string | Greyed text shown while the box is empty. |
stacked | boolean | True puts the caption above the box, false beside it. When omitted, the room available decides. |
mono | boolean | A fixed-width font, for code. |
clear | boolean | Puts a small cross at the right end of the box while it holds text. One press empties the box, fires Typed with "" and leaves the keyboard in the box. For a search box. |
WaxSectionOptions
Used by container:Section.
| Option | Type | Description |
|---|---|---|
open | boolean | False starts the section collapsed. |
collapsible | boolean | False makes a plain titled group that is always open. |
badge | string | A word or two shown in a small pill at the right end of the title, such as "New" or "Off". |
badge_color | table | The colour of the badge: a theme colour. The muted text colour when omitted. |
marks | { icon: string, text: any }[] | Small counts at the right end of the title, each an icon with a number or a word. |
fit | boolean | Keeps the title on one line. A title too long for the card is cut short with "..." and shown whole as a tip while the mouse rests on it, and it is cut again when the card gets another width. Without it a long title wraps. |
WaxRowOptions
Used by container:Row.
| Option | Type | Description |
|---|---|---|
height | number | The least height of the row. Give two rows the same one and they are equally tall whatever is in them. |
WaxProgressOptions
Used by container:Progress.
| Option | Type | Description |
|---|---|---|
color | WaxColor | string | integer | The accent colour when omitted. "#RRGGBB" works too. |
WaxFieldOptions
Used by container:Field.
| Option | Type | Description |
|---|---|---|
mono | boolean | Shows the value in the small fixed-width font, for numbers that keep changing. |
WaxConsoleOptions
Used by container:Console.
| Option | Type | Description |
|---|---|---|
height | number | Default 220. On a page made with scroll = false it takes the space left when omitted. |
max | integer | The most lines shown. Default 150. |
WaxPictureOptions
What Container:Picture takes besides the file.
Used by container:Picture.
| Option | Type | Description |
|---|---|---|
height | number | How tall the picture is drawn. 160 when omitted. It is drawn less tall when that would make it wider than the room it has. |
on_click | fun() | Makes the picture something to press, and runs this when it is pressed. |
selected | boolean | Draws a line around the picture, for the chosen one of several. Only with on_click. |
WaxTileOptions
What a Tile shows.
Used by container:Tile.
| Option | Type | Description |
|---|---|---|
title (required) | string | The name, in bold, kept to one line. |
note | string | A few muted words after the title, such as a version. |
text | string | A line or two under the title. Longer text is cut short. |
badge | string | A word or two in a small pill at the right end. |
badge_color | table | The colour of the badge: a theme colour. |
marks | { icon: string, text: any, on_click?: fun(), active?: boolean, color?: table }[] | Small counts before the badge, each an icon with a number or a word. One with on_click is a small button of its own, pressed without pressing the card, and is drawn in its color while active is true. |
picture | string | The whole path of a .png or .jpg file, drawn faded behind the card. |
on_click | fun() | Runs when the card is pressed. |
WaxBadgeOptions
What Container:Badge takes besides the text.
Used by container:Badge.
| Option | Type | Description |
|---|---|---|
color | table | A theme colour. The muted text colour when omitted. |
WaxCountOptions
What Container:Count takes besides the icon and the value.
Used by container:Count.
| Option | Type | Description |
|---|---|---|
color | table | A theme colour for the icon and the value. The usual colours when omitted. |
WaxGridOptions
Used by container:Grid.
| Option | Type | Description |
|---|---|---|
make (required) | fun(cell: WaxContainer): any | Called once for each cell that is needed: add one control to cell and return whatever show needs. |
show (required) | fun(made: any, item: any, index: integer) | Called whenever a cell is to show another item. |
items | any[] | The list to show, of any length. |
cell | number | Least width of a cell. Default 38. As many columns as fit share the width. |
cell_height | number | Default: the same as cell. |
gap | number | The space between cells. Default: the theme's spacing. |
batch | integer | How many cells are made in one frame. Default 24. Use fewer for cells with a lot in them. |
height | number | Default 300. On a page made with scroll = false the grid takes the space left when omitted. |
spare | integer | Rows kept ready above and below the ones that show, so a fast scroll does not show empty space. Default: half of what shows, between 2 and 6. |
warm | boolean | Makes the cells one a frame from the moment the grid exists, also while the menu is closed, so the list is there the first time it is shown. |
view | number | With warm: the height in pixels the list is expected to show. Default: the window's height. |
WaxFlowOptions
Used by container:Flow.
| Option | Type | Description |
|---|---|---|
cell | number | Makes it a grid: every control gets the same width, at least this, and each line is full. |
WaxItemLook
What one line of a list or a tree shows. What is left out is not shown.
Returned by item:Get. Used by item:Set.
| Field | Type | Description |
|---|---|---|
text (optional) | string | The name. |
note (optional) | string | Dimmer text after the name. |
value (optional) | string | Text at the right, in a fixed-width font. |
icon (optional) | string | An icon name. |
indent (optional) | integer | How many steps the line is moved in, for a tree. |
arrow (optional) | boolean | true shows an arrow that is open, false one that is closed. Leave it out for no arrow. |
selected (optional) | boolean | Marks the line as the picked one. |
tone (optional) | "text" | "dim" | "accent" | "accent_hover" | "good" | "warn" | "bad" | The colour of the value. |
faint (optional) | boolean | Draws the name dimmer. |
name_width (optional) | number | For a line made with columns: how wide the name is, so values line up from line to line. |
width (optional) | number | For a line made with fit that is narrower than its container: how wide it is. |
WaxItemOptions
Extends WaxItemLook. Used by container:Item.
| Option | Type | Description |
|---|---|---|
weight | number | In a row, its share of the width. |
columns | boolean | Makes it a line of a table: the name, then the value where the name ends, then the note at the right edge. |
divider | boolean | Draws a thin line under it. |
fit | boolean | Cuts a name, note or value that is too long for the line short with "..." and shows the whole of it as a tip while the mouse rests on the line. |
WaxSplitOptions
Used by container:Split.
| Option | Type | Description |
|---|---|---|
share | number | The left area's part of the width, 0 to 1. Default 0.42. |
least | number | The narrowest an area may be. Default 240. With less room than two of these, one area shows at a time. |
height | number | Default 300. On a page made with scroll = false the split takes the space left when omitted. |
WaxSlotLook
What one cell of a Slots control shows. A cell with no look is empty and takes no clicks.
Returned by ui.Hovered, slots:GetLook. Used by slots:Set, slots:SetLook.
| Field | Type | Description |
|---|---|---|
image (optional) | string | A picture of the game by its path, such as an item's icon. |
icon (optional) | string | An icon by name, for a cell with no picture. |
count (optional) | string | number | Small text in the lower right corner. |
mark (optional) | string | A small icon in the upper left corner. |
value (optional) | any | What the signals and ui.Hovered give for this cell. |
tip (optional) | string | table | fun(): any | The tooltip: a text, { title = "...", lines = { "text" or { "text", "warn" } } }, or a function that returns one. |
dim (optional) | boolean | Draws the picture faint, or the icon of a cell that has no picture. |
selected (optional) | boolean | Marks the cell as the chosen one. |
tone (optional) | "good" | "warn" | "bad" | "accent" | A short line of that colour under the picture. |
plain (optional) | boolean | A picture only: no box, and the mouse passes over it. |
WaxSlotsOptions
Used by container:Slots.
| Option | Type | Description |
|---|---|---|
columns | integer | Default 9. |
rows | integer | Default 1. |
size | number | The side of a cell. Default 36. |
gap | number | Space between cells. Default 2. |
backing | boolean | False leaves out the box behind each cell. |
align | "left" | "center" | "right" | Where the block sits in its line. |
below | number | Space under the block. The theme's spacing when omitted. |
looks | WaxSlotLook[] | What to show at the start. |
Named values
Short names for a fixed set of values. Where a function asks for one of these, pass one of the values listed.
WaxConsoleLine
One console line: the text, then an optional colour.
The same as { [1]: any, [2]: WaxColor? }.