Creates a new segmented button.
The frame for the button. This should have a height of 1.
The text for each button. This must have at least one button.
The action to call when a selection changes
Protected_Whether the object can become the first responder.
The function to call when the selection changes.
Whether the view is currently focused.
Whether the view is hidden.
Whether the view needs to be redrawn.
Whether the view needs to be laid out.
Whether constraints need to be updated.
OptionalnextThe next responder in the responder chain.
The list of subviews inside this view.
OptionalsuperviewThe view that contains this view, if it exists.
Whether user interaction is enabled for this view.
OptionalwindowThe window this view is located inside.
The background color of the view.
The color of the button when clicked.
The color of the button.
The number of buttons in the segmented button.
The color of the button when in default state.
The position and size of the view.
Whether the control is enabled.
The currently selected button.
The color of the text.
The color of the text when disabled.
The color of the text when selected.
Adds a new button to the list of buttons.
The text for the button
The index to place the number after (defaults to the end)
Adds a constraint to the view. The first item of the constraint MUST be this view.
The constraint to add
Adds a list of constraints to the view. The first item of the constraints MUST be this view.
The constraints to add
Notifies the object that it's about to become the first responder.
Whether to accept the first responder status
Moves a subview so it appears on top of its sibling views.
The view to move
This is used to place a blinking cursor on screen while not drawing. It's only called on the first responder of a window.
The position and color of the cursor in window coordinates, or undefined to not place a cursor
Called when a subview was added to this view.
The new view that was added
Called when the superview of this view changes.
Displays a view in the specified rectangle. This should not be called by other code.
The rectangle to draw inside
Draws the view inside the specified rectangle. Override this function to provide custom view types.
The rectangle to draw inside
Returns the text for a button by index.
The index to get
The text for the button, or undefined if out of range
Sends a list of key input events to the input manager, which will send
back text input events through insertText(text: string).
The input events to send
Lays out the view hierarchy following constraints. This should only be called on a superview, which is done automatically.
Handles when a method action fails to find a responder.
The method that was attempted
Removes a constraint from the view. The first item of the constraint MUST be this view.
The constraint to add
Removes this view from its superview.
Notifies the object that it's about to no longer be the first responder.
Whether to resign first responder status
Moves a subview so it appears under its sibling views.
The view to move
Sets the view as requiring a full redraw.
Tells the receiver that the frame or constraints of the sender changed. This triggers the receiver to update its constraints if any are related to the sender, and cascades the message up and down throughout the hierarchy. It will also trigger a cascade on itself if it needs to update constraints.
Attempts to call the specified method on the object, passing the call on to the next responder if this object doesn't implement it.
The name of the method to call
Any parameters to pass to the method
Whether a responder was able to respond to the method
Checks whether the passed object can become the first responder from the specified event.
The object to check
The event that was sent
Whether the object is allowed to be the first responder
StaticaddAdds a number of constraints to views using code. This can simplify settings constraints by using familiar code syntax instead of lengthy constraint constructions and activations.
The syntax is fairly simple:
<ViewName>.<Attribute> = [<Multiplier> *] <ViewName>.<Attribute> [+|- <Constant>]
<ViewName>.<Attribute> = <Constant>
The code is processed using Lua as the parser, so it's not strictly required to be in exactly this format; but mind that operators other than add/sub/mul/div/unm aren't supported (and division is only valid if the divisor is a number), and no libraries are available in the environment.
The constraint code to apply
A key-value map of names of views in the code, to the views they represent
A segmented button displays multiple buttons in a single view, with only one selected at a time.

Example: Create a segmented button with three choices.