A newer version of Max is available. Click here to access the latest version of the documentation

textbutton Reference

Button with text

textbutton

Arguments

None.

Attributes

active [int] (default: 1)

When active mode is set to 0, the textbutton object will not respond to mouse clicks, and the object is grayed out. This attribute is enabled by default.

align [atom]!

Sets the text alignment.

bgcolor [4 floats]

Sets the background color of the textbutton object when the button is in the "off" state in RGBA format.

bgoncolor [4 floats]

Sets the background color of the textbutton object when the button is in the "on" state in RGBA format.

blinktime [int] (default: 150)

Specifies the duration (in milliseconds) that the textbutton object will flash when it is clicked upon or receives a bang message.

Toggles setting the size of the button to the currently selected font size and character width.

legacytextcolor [int] (default: 0)7.0.0

Toggles legacy behavior for text and allows for the selection of a text color for "off" states. The text off color is set using the textcolor attribute.

mode [int] (default: 0)

Sets the button mode.

Possible values:

0 = 'Button'
1 = 'Toggle'

outputmode [int] (default: 1)

Sets the output mode. Output modes are:

0: Send output on mouse down
1: Send output on mouse up (default)

Possible values:

0 = 'Mouse down'
1 = 'Mouse up'

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. (default = 1).

rounded [float] (default: 0.)

Sets the amount in pixels by which to round the textbutton shape.

spacing_x [float] (default: 4.)

Sets the horizontal spacing for the textbutton object in pixels.

spacing_y [float] (default: 4.)

Sets the vertical spacing for the textbutton object in pixels.

style [symbol] (default: )7.0.0

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

text [atom] (default: Button)

Sets the button label, and sets the the "off" state label when mode is set to 1 (toggle).

textcolor [4 floats]

Sets the text color for the textbutton object when the button is in the "off" state in RGBA format. The textcolor attribute is mapped to the accentcolor style color.

texton [atom] (default: Button On)

Button label in "on" state

textoncolor [4 floats]

Sets the text color for the textbutton object when the button is in the "on" state in RGBA format. The textoncolor attribute is mapped to the color style color.

textovercolor [4 floats]

Sets the text color for the textbutton object on mouseover when the button is in the "off" state in RGBA format. The textovercolor attribute is mapped to the selectioncolor style color.

tosymbol [int] (default: 1)

Output text as a single symbol

truncate [int] (default: 1)

Sets the text truncation mode. Alignment modes are:

0: no truncation
1: truncate from the right (e.g. abcdef... . This is the default.
2: truncate from center (e.g. abcd...wxyz

Possible values:

0 = 'No truncation'
1 = 'Truncate from the right'
2 = 'Truncate from the middle'

underline [int] (default: 0)

The word underline, followed by a zero or one, toggles the underlining of text in the textbutton object. The default is 0 (no underlining).

usebgoncolor [int] (default: 0)7.0.0

Toggles the use of a background "on" color.

usetextovercolor [int] (default: 0)7.0.0

Toggles the use of a different color when hovering over the text.

Common Box Attributes

Parameter Attributes

Messages

bang

The behavior depends on the current mode settings.

mode 0 (button): A bang message will re-trigger the object's output.

mode 1 (trigger): A bang message will switch the object's state and trigger the output.

int

Arguments

input [int]
If the mode attribute is set to 0 (button), a bang is sent out the left outlet, and the text message is displayed and set out the middle outlet.

If the mode attribute is set to 1 (toggle), and the number input is 1, textbutton is set to 'on', a 1 is sent out the left outlet and the texton message is displayed and set out the middle outlet.
If the number input is 0, textbutton is set to 'off', a 0 is sent out the left outlet and the text message is displayed and set out the middle outlet.

float

Arguments

input [float]
At float message is converted to int. See the int listing for usage.

(mouse)

If the mode attribute is set to 0 (button), a mouse click on textbutton highlights it for as long as the mouse is held down, sending a bang out the left outlet when the mouse button is pressed down, and another bang out the left outlet when the mouse button is released. The button text is also sent out the middle outlet on mouse click.

If the mode attribute is set to 1 (toggle), and the initial state of the toggle is 0, textbutton is set to 'on', a 1 is sent out the left outlet and the texton message is displayed and set out the middle outlet.
If initial state of the toggle is 1, textbutton is set to 'off', a 0 is sent out the left outlet and the text message is displayed and set out the middle outlet.

set

Arguments

set-input [int]
If the mode attribute is set to 1 (toggle), the set message toggles the on or off state without sending anything out the outlets. The word set, followed by any non-zero number, sets toggle to on; set 0 sets it to off.

setsymbol

Arguments

button-text-item [list]
If the mode attribute is set to 1 (toggle), the word setsymbol, followed by either the texton or text symbol, causes the textbutton to display that symbol, but does not cause any output. The symbol is case-sensitive.

symbol

Arguments

button-text-item [list]
If the mode attribute is set to 1 (toggle), the word symbol, followed by either the texton or text symbol, causes textbutton to display that symbol, switch to the toggle state, and trigger the corresponding output.

See Also

Name Description
matrixctrl
message
pictctrl
pictslider
tab
ubutton