Pages

Friday, August 28, 2009

Display data in UI rollout

Today I found a question in the forum on the display of data in scripted UI rollout instead of print to Listener. This new to maxscript user just try some complicated and roundabout way but but this is normal in early. He want to display distance between next and previous frame and ask how to do that in scripted rollout. The answer is sample, just need to add UI controller that will display needed data. It can be edittextbox if we want to copy the result, or just a label controll. What is important here is that we need to convert our data to string. That's all. And there is an short example that I post to help:

if (test_roll != undefined) do
if (test_roll.isdisplayed) do
(destroyDialog test_roll)

rollout test_roll "testUI"
(
fn objSelFilter obj = (superClassOf obj == geometryClass)
label showme "" align:#left pos:[10, 10]
pickbutton pbt_selObj "Select. objet" autoDisplay:true \
pos:[10, 40] width:80 filter:objSelFilter

on pbt_selObj picked obj do
(
if obj != undefined do
(
result = (At time (currentTime+1) obj.pos.x) \
- (At time currentTime obj.pos.x)
showme.text = result as string
)
)
)

createDialog test_roll 150 80

No comments:

Post a Comment

Thanks for your comment