All defined user-interface controls have a local variable constructed for them in the rollout and a value representing the control is placed in that variable. These values typically contain state information relevant to the item, such as if a check box is checked, the current spinner value, the items in a list box, and so on. This information is made available to you as various named properties on the item values. You use standard MAXScript property access to read and set these values,
FOR EXAMPLE | |
---|---|
frab_x.enabled = true |
enable the frab_x spinner |
foo.text = "Don't do it" |
set foo button text |
first_item = baz.items[1] |
get item list from listbox baz
|
$bar.pos.x = x_spinner.value |
get current value from spinner x_spinner
|
All of the user-interface common properties except for caption
(the label string value is used as the caption) can be specified as parameters when the user-interface item is constructed.
EXAMPLE
button foo "You Cannot Press Me!" enabled:false
<ui_item>.caption String
The meaning of this property varies depending on the specific user-interface item type. If the user-interface item has a caption, this property contains the caption string. For the various types of buttons, it is the text inside the button. The default value of the caption is the label string specified in the item definition.
<ui_item>.text String
For all the user-interface items except edittext
and combobox
, the .text
property is an alias of the .caption
property.
For edittext
and combobox
user-interface items, it is the text in the edit box.
The default text
property value for edittext
user-interface items is a null string ("").
The default text
property value for combobox
user-interface items is the selected item’s text.
The .text
property in 3ds Max 7 and higher is really equivalent to the .caption
property for all rollout controls that do not define .text
separately.
Setting a label's text is the same as setting a label's caption. In previous releases, setting the text would not update the UI, but would update the internal .caption
value
<ui_item>.enabled Boolean default: true
Sets whether the item is enabled for interaction when the rollout is initially opened. Disabled items appear unavailable in the rollout. All items are enabled by default, so you typically use this parameter to disable those items that should not initially be available to the user. For example, you might have some spinners that change the properties on a scene object that should not be changed until the user has picked the object, typically with a pickbutton
in the rollout. You would disable the spinner in its definition, as in the following example, and enable it once the user picked an object.
EXAMPLE
spinner frab_x "Frabulate x-axis:" range:[0,100,0] enabled:false ... frab_x.enabled=true
<ui_item>.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.
<ui_item>.visible
When set to false
, the UI Item is hidden and disabled.
EXAMPLE
rollout test "test" ( button b1 "b1" on b1 pressed do print "b1" button b2 "b2" on b2 pressed do b1.visible = not b1.visible ) createdialog test --Pressing the 'b2' button hides and unhides the b1 button
<ui_item>.hwnd Integer, read-only
Contains an array of the HWND Window handles of the control's rollout if the rollout is open, or an empty array if the control's rollout is closed.
Available in 3ds Max 2011 and higher.