Rollout User-Interface Controls Common Layout Parameters

 

   

Creating User Interfaces - Quick Navigation

The layout of user-interface items defined in a utility or rollout is, by default, handled by MAXScript.

It places each successive interface item down the rollout, one below the other, horizontally and vertically aligning them to match the layout conventions in the built-in 3ds Max command panels.

For the most part, this works well, particularly for rollouts displayed in the Utilities panel, because there is usually just enough room for one item across.

In some cases, you may want to adjust or override the automatic layout and for this there are a number of definition-line layout parameters you can use.

The user-interface element <parameters> that can be supplied in the item definition varies with the item type and is defined in each type's topic, for example spinner ranges, check box initial states, list box contents, and so on.

There is, however, a set of common layout parameters that you can specify on any user-interface item.

Except for the pos: parameter, these parameters are not properties of the user-interface item and cannot be accessed or changed by a script once the control has been created.

   

The common layout parameters for all user-interface items are:

align:#left
align:#center
align:#right

Aligns the user-interface item to the left, center, or right in the rollout. Default varies by type.

   

offset: <point2> default: [0,0]

Specifies an [x,y] offset in pixels relative to automatic placement. This is applied after all other layout parameters are applied, and can be used to adjust them.

   

width: <number> default: varies

Forces the user-interface item to a specified width in pixels. Useful with buttons, for example, which otherwise self-size to their text label. Specifying an explicit width always overrides any widths computed from the text or caption properties. For example, if a spinner is given a fixed width that is too small for both label and spinner, it always aligns things to show the spinner and so might push the text out of view.

   

height: <number> default: varies by type

Forces the user-interface item to a specified height, typically in pixels. This lets you override the default setting height for user-interface items.

EXAMPLE

button foo "Stop" width:75 height:25

makes a nice big stop button.

For comboBox , dropdownList and listBox user-interface items, the height is in text rows.

To have a comboBox exactly display N items, set height to N+2 .

To have a dropdownList exactly display N items in the list, set height to N+2 .

To have a listBox exactly display N items, set height to N .

Height has no affect on spinner and slider user-interface items.

   

across: <number> default: 1

   

Causes this and following <number>-1 items to be laid out horizontally rather than vertically. The <number> given defines how many items to arrange horizontally. Layout then reverts to normal vertical placement. This parameter effectively divides the utility into the given number of equal-width columns and places items within them using the normal alignment for each item. The other layout parameters can be used with the across: parameter to control layout within the item's column.

pos: <point2> default: varies

This forces the user-interface item to a fixed [x,y] pixel position in the rollout, with [0,0] at the top-left corner.

EXAMPLE:

button foo "foo" align:#right -- default alignment is center
-- align right and bump this button down a bit:
button baz "baz" align:#right offset:[0,6]
-- put b1, b2, b3 across:
checkbutton b1 "yes" across:3
checkbutton b2 "no"
checkbutton b3 "maybe"
-- default alignment is right
spinner s1 "Length:" align:#left

See Also