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

textbutton

A user interface button/toggle

Description

A user interface button/toggle

Arguments

None.

Messages

bang The behavior of the textbutton object on receiving a bang message varies depending on the object's mode of operation. The modes are:

button mode: A bang message will retrigger the object's output.
toggle mode: A bang message will invert the object's state and trigger the output.
int input [int]
In the toggle mode, any non-zero number will toggle the button to the "on" position, send a one out the left outlet and the button text out the middle outlet. A zero sets the toggle to the "off" position, sends a zero out the left outlet and the button text out the middle outlet.
float input [float]
Converted to int.
(mouse) In button mode, 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.
In toggle mode, a mouse click behaves the same as a toggle. When the mouse is clicked, textbutton will send a 1 out the left outlet if the cursor is inside of the ubutton object's rectangle, and 0 if it is not. The button text is also sent out the middle outlet on mouse click.
In both modes the object will send a one out the right outlet if the cursor is over the textbutton object's rectangle, and zero if it is not.
set set-input [int]
In the toggle mode, the set messages 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 button-text-item [list]
In the toggle mode, the word setsymbol, followed by a symbol that specifies button text item, causes the textbutton to display that item, but does not cause any output.
symbol button-text-item [list]
In the toggle mode, the word symbol, followed by a symbol that specifies a button text item, causes textbutton to display that symbol and act as though the object were toggled to that state. text out the second outlet.

Attributes

Name Type g/s Description
active int
def.:1
Toggles active mode. When active mode is disabled, the textbutton object will not respond to mouse clicks, and the object is greyed out. The default mode of operation is enabled (1).
align int
def.:1
Sets the text alignment. The modes are:

0: Left
1: Center
2: Right
bgcolor float Sets the background color for the textbutton object when the button is in the "off" state in RGBA format.
bgoncolor float Sets the background color for the textbutton object when the button is in the "on" state in RGBA format.
bgovercolor float Sets the background color for the textbutton object on mouseover when the button is in the "off" state in RGBA format.
bgoveroncolor float Sets the background color for the textbutton object on mouseover when the button is in the "on" state in RGBA format.
blinktime int
def.:150
Specifies the duration (in milliseconds) that the textbutton object will flash when it is clicked upon or receives a bang message.
border int
def.:2
Sets the thickness, in pixels, of the textbutton object's border
bordercolor float Sets the border color for the textbutton object when the button is in the "off" state in RGBA format.
borderoncolor float Sets the border color for the textbutton object when the button is in the "on" state in RGBA format.
fontlink int
def.:0
Toggles setting the size of the button to the currently selected font size.
mode int
def.:0
Sets the button mode. Button modes are:
0 button mode
1 toggle (switch) mode
outputmode int
def.:1
Sets the output mode. Output modes are:
0 send output on mouse down
1 send output on mouse up (default)
rounded float
def.:14.
Sets the radius, in pixels for the textbutton object.
spacing_x float
def.:4.
Sets the horizontal spacing for the textbutton object in pixels.
spacing_y float
def.:4.
Sets the vertical spacing for the textbutton object in pixels.
text atom
def.:Button
Sets the button label when the button is in the "off" state.
textcolor float Sets the text color for the textbutton object when the button is in the "off" state in RGBA format.
texton atom
def.:Button On
Sets the button label when the button is in the "on" state.
textoncolor float Sets the text color for the textbutton object when the button is in the "on" state in RGBA format.
textovercolor float Sets the text color for the textbutton object on mouseover when the button is in the "off" state in RGBA format.
textoveroncolor float Sets the text color for the textbutton object on mouseover when the button is in the "on" state in RGBA format.
tosymbol int
def.:1
Toggles outputting text as a single symbol.
truncate int
def.: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
underline int
def.: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).

Information for box attributes common to all objects

Menu Items

Name Description
Color Choosing the Color... menu item from the Object menu when the object is selected opens a color picker, permitting adjustment to the appearance of the textbutton object.

Examples

See Also

Name Description
matrixctrl Matrix switch control
pictctrl Picture-based control
pictslider Picture-based slider control
tab A user interface tab/multiple button object
ubutton Transparent button, sends a bang