MAXScript Tools and Interaction with 3ds Max > Creating MAXScript Tools > Scripted Utilities and Rollouts > Rollout User-Interface Controls > Rollout User-Interface Controls Types >

# Button UI Control

User Interface Controls > Common Properties > Layout > Types > Button

| Creating User Interfaces - Quick Navigation

A button control is used to place a press button on the rollout which the user can click, typically to perform some task.

The syntax is:

    button <name> [<caption>] [images:<image_spec_array>] [toolTip:<string>] [border:<boolean>]

The default alignment of button items is #center .

EXAMPLE:
    rollout test_buttons "Testing Buttons"
    (
      button theButton "Press me!"
      button theBorderlessButton "I am a button, too!" border:false
      on theButton pressed do
        messagebox "Remember: Never press unknown buttons!"
    )
    createDialog test_buttons 150 60

Parameters:

    images:

An image-specification array for providing bitmap images for the button. If this is specified, the <caption> is ignored and the contents of the button are replaced with the bitmaps.

See Image Buttons for details

    toolTip:

Provides text for a tooltip for the button; no tooltip if unsupplied.

    border:

When set to true or not specified, the button will be drawn with a border. This was the default behavior prior to 3ds Max 2009.

When set to false, the button will be drawn without a border, making it one with the UI background.If the button is enabled, the border will appear when the button is pressed, or upon mouseover.

Available in 3ds Max 2009 and higher.

Properties:

    <button>.imagesArray

Sets the image-specification array for the button.

This property is write-only.

Setting the value to undefined will set the control back to displaying its caption rather than images in 3ds Max 8 and higher.

See Image Buttons for details

    <button>.tooltipString

Get/set the tooltip string of the button.

Available in 3ds Max 9 and higher.

EXAMPLE:
    rollout test "Test"
    (
      button btn_test "Test" tooltip:"This is a tooltip"
    )
    createDialog test
    --> Rollout:test
    --> true
    test.btn_test.tooltip -- get the tooltip string
    --> "This is a tooltip"
    test.btn_test.tooltip = "Now you can get and set the tooltip!"
    --> "Now you can get and set the tooltip!"
    test.btn_test.tooltip -- get the new tooltip string
    --> "Now you can get and set the tooltip!"

Events

    on <button> pressed do <expr>

Called when the user clicks the button.

    on <button> rightclick do <expr>

Called when the right mouse button is released over the button. Available in 3ds Max 8 and higher.

#### See Also

- Rollout User-Interface Items Common Properties

- Rollout User-Interface Items Common Layout Parameters

- Rollout User-Interface Control Types

- Similar Controls

- Materialbutton

- Mapbutton

- Pickbutton

- Checkbutton