toggle Reference

Switch between off and on (0/1)

toggle

Description

When clicked, toggle outputs a 0 when turned off and a 1 when turned on. When giving input, a non-zero number will turn it on, a 0 will turn it off, and a bang will alternate the state of the toggle. All numbers are converted to integer and passed through unchanged.

Examples

Used as an onscreen controller, or to display the on/off status of numbers passing through

Arguments

None.

Attributes

bgcolor [4 floats]

Sets the background color for the object in RGBA format.

checkedcolor [4 floats]

Sets the checked color for the object in RGBA format.

parameter_enable [int]

Enables use of this object with Max for Live Parameters and allows for setting initial parameter values in the Max environment.

parameter_mappable [int] (default: 1)

When parameter_mappable is enabled, the object will be available for mapping to keyboard or MIDI input using the Mappings feature.

style [symbol] (default: )7.0.0

Sets the style to be applied to the object. Styles can be set using the Format palette.

thickness [float] (default: 50.)7.0.0

Sets the check thickness for the object.

uncheckedcolor [4 floats]7.0.0

Sets the unchecked color for the object in RGBA format. The uncheckedcolor attribute is mapped to the elementcolor style color.

Legacy

elementcolor

Typelist (3 ints)

elementcolor is a legacy RGB alias for the uncheckedcolor RGBA attribute. See here for more information.

Common Box Attributes

Parameter Attributes

Messages

bang

Switches toggle on if it is off; switches it off if it is on.

int

Arguments

input [int]
The number is sent out the outlet. If the number is not 0, toggle displays an X, showing it is on. If it is 0, toggle is blank, showing it is off.

float

Arguments

input [float]
Converted to int. See int listing.

(mouse)

A mouse click on toggle switches the object on if it is off and off if it is on.

outputvalue7.0.0

Output current value without changing state.

set

Arguments

set-input [int]
Switches the toggle on or off without sending anything out the outlet. The word set, followed by any non-zero number, sets toggle to on; set 0 sets it to off.

Output

int

A number received in the inlet is sent out the outlet. A bang or a mouse click sends 1 or 0 out the outlet, depending on whether toggle is being turned on or off.

See Also

Name Description
Max For Live Max For Live
led
matrixctrl
pictctrl
radiogroup
tab
textbutton
togedge
ubutton
Max Basic Tutorial 4: Metro and Toggle Max Basic Tutorial 4: Metro and Toggle