Button

A button item is used to place a press button on the rollout which the user can click, typically to have some task performed. The syntax is:

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

The default alignment of button items is #center.

Example

rollout test_buttons "Testing Buttons"

(

button theButton "Press me!"

on theButton pressed do

(

 messagebox "Remember: Never press unknown buttons!"

)

)

createDialog test_buttons 150 50

 

Testing_Button_UI_01.gif

 

Parameters

images:

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

The form is:

images:#(<image>, <maskImage>, <count_integer>, \
<enabled_out_image_index>, <enabled_in_image_index>, \
<disabled_out_image_index>, <disabled_in_image_index>)

where <image> and <maskImage> can be either a bitmap file-name string or a MAXScript bitmap value. <count_integer> specifies the number of sub-images in the bitmaps, and the image_index values specify which sub-image in the bitmaps is to be used for each of the four button states.

For example:

bm1 = render camera:$cam01 outputSize:[80,60].

...

button foo images:#(bm1, undefined, 1, 1, 1, 1, 1)

In this example, the button would use the rendered image as the button image.

Another Example:

button decay images:#("dcybtns.bmp", "dcymask.bmp", 6, 1, 4, 1, 4)

In this example, the button would use sub-images 1 and 4 of bitmaps dcybtns.bmp and dcymask.bmp for the out and in states of the button, respectively.

See also Image Buttons.

toolTip:

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

Properties

<button>.images Array

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.

 

For example:

rollout image_button_test "Image Button"

(

button theButton "Press To Render!" width:200 height:200

on theButton pressed do

(

 theBmp = render outputsize:[200,200] vfb:off

 theButton.images = #(theBmp, undefined, 1,1,1,1,1 )

)

)

createDialog image_button_test 210 210

 

Testing_Button_UI_02.gif Testing_Button_UI_03.gif

 

<button>.tooltip String

new.gif NEW in 3ds Max 9: Get/set the tooltip string of the button.

For 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