How do I display a value in a Rollout?

MAXScript FAQ > Scripted UI > How do I display a value in a Rollout?

The following script is a test bed for value display in different User Interface elements. It is intended to show how to update UI properties to give feedback to the user.

Copy the code into a new Script Editor, press Ctrl+E to evaluate and press the "Generate New RANDOM Value" multiple times to see different methods to display the value in the Rollout.

SCRIPT

rollout test_digits "Display Values"
(
  group "Display"
  (
    spinner spinner_item "The Value:" range:[0,1000,0] align:#center fieldwidth:50
    edittext edit_text_item "The Value:" text:""width:100 align:#center
    button button_item "No Value" width:100 align:#center
    label label_item "No Value" align:#center
    progressbar progress_bar_item height:10 width:180 color:(color 255 100 100) orient:#horizontal
    listbox list_box_item items:#()
  )
  button start_test "Generate New RANDOM Value..."
  progressbar progress_bar2_item height:90 width:10 color:(color 255 100 100) orient:#vertical pos:[12,20]
 
  on start_test pressed do
  (
    minValue = 0
    maxValue = 100
    theValue = random minValue maxValue
    sliderTime = theValue
 
    spinner_item.value = theValue
    edit_text_item.text = theValue as string
    button_item.text = theValue as string
    label_item.text = theValue as string
    progress_bar_item.value = 100.0*theValue/maxValue
    progress_bar_item.color = color (255.0*theValue/maxValue) 128 0
    progress_bar2_item.value = 100.0*theValue/maxValue
    list_box_item.items = append list_box_item.items ("Value is now "+theValue as string)
    list_box_item.selection = list_box_item.items.count
  )--end on
)--end rollout
createDialog test_digits 200 300

See Also