Image Buttons

Four rollout user-interface item types, button, checkbutton, mapbutton, and materialbutton, can be either simple text buttons containing text labels or image buttons inside of which bitmaps can be displayed instead of text. The images to be displayed in these buttons are specified using the definition-line parameter images:.

The parameter 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]

...

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

would use a rendering as the button image.

If the image or maskImage is specified as a file name, the bitmap file is searched for in the following directories (in order of search): current MAXScript directory, MAXScript startup directory, MAXScript directory, 3ds Max bitmap directories, and then the 3ds Max image directory.

There are four images that can be specified, one for each of the possible button states, enabled-out, enabled-in, disabled-out, and disabled-in. These images are taken from a single bitmap file or MAXScript bitmap value in which a number of images are stored side-by-side. This bitmap, containing one or more images to use for the button, is called the imagelist. All the sub-images in such an imagelist are taken to be the same width and you specify which image is used for which state by providing an image-index into the bitmap. This means you can store the images for all the states of many buttons in one file, specifying different indexes for the different buttons.

You can also specify a black-and-white mask image used to mask the image display into the buttons. It is given in the same imagelist form and the mask image indexes must be the same as the images they correspond to. Black pixels in the mask let the corresponding image pixel show; white pixels hide corresponding image pixels and show the default background color for the button. If there is no mask file, supply the value undefined for the mask file name.

Bitmap files without full path names are searched for in the Startup scripts directory, then the scripts directory, then the 3ds Max images directory, then the 3ds Max executables directory, and then the directories in the PATHS environment variable.

You can change the images in a button by setting the .images property of these user-interface items,

For example:

-- re-render, update button

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

foo.images = #(bm1, undefined, 1, 1, 1, 1, 1)

Example:

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

In this example, the images are in a file dcybtns.bmp and the masks in dcymask.bmp. These bitmap files each have six images across and the out-state is image 1 and the in-state is image 4. Both enabled and disabled here are given as the same image, presumably because this particular button will never be disabled.