[Closed] Renaming a label
I’ve been researching this, but I can’t find the answer. I feel like this is crazy simple but…
How do I use a varible to rename a label? This is what I think should do it, but it doesn’t.
(this code is inside a button)
rollout SetUpStatus "Setup Status"
(
label lblIRStatus align:#center
lblIRStatus.text = "test"
)
createDialog SetupStatus 200 300
I recieve the error message:
–Syntax error:at., expected name
– In line: lblIRStatus.t
how do I dynamically add text to a label?
Hey Reggie, you can’t just setup a variable like that in the rollout itself. You can however, change it in an event. In this case, when the dialog opens:
(
rollout SetUpStatus "Setup Status"
(
label lblIRStatus align:#center
on SetupStatus open do
(
lblIRStatus.text = "test"
)
)
createDialog SetupStatus 200 300
)
Labbejason,
Thanks again for your help. I had learned this was going to be difficult for what Im trying to achieve, so I’ve switched to using a “edittext” box instead. What Im trying to create is a Status box that will popup when a button is pressed, this box will list the name of cameras that have been sent for rendering. Right now everything works except getting variables to read in the textbox… After making changes this is what I have so for:
rollout SetUpStatus "Setup Status"
(
edittext txtIRStatus align:#center fieldwidth:190 height:350 readonly:true align:#center
on txtIRStatus changed do
(
txtIRStatus.text = "Test"
)
)
createDialog SetupStatus 200 360
“Test” will be replaced with a variable CameraName that calls the name of cameras elsewhere in the code. But first I want to get “Test” to display correctly in the rollout
So if you want to display the cameras you are going to send to rendering, may I suggest using a listBox instead? Unlike editText, you’ll be able to display multiple cameras very neatly and easily. Here’s an example:
(
rollout getCamDialog "Get Cameras"
(
group "Camera List"
(
listBox camList "" items:#() readOnly:true
)
button getCam "Get Cameras from Scene" width:190 height:15
on getCam pressed do
(
myCams = for o in cameras where (superClassOf o) == camera collect o.name
camList.items = myCams
)
)
createDialog getCamDialog 200 195
)
Jason,
Thanks for posting! I sent you a private message. Let me know if you have any suggtions based off what Im trying to achieve. I will work with the listbox and see what I can achieve!
LOL I sent you another private message as you wrote this :P. Let’s keep it on here so everybody else can pitch in their 2 cents.
I just recommended that since it was only one camera being done at a time, to just stick with something simple like messageBox.
Is it possible to update a messagebox that is has already been created? If the scene has 20 cameras to render, I wouldn’t want 20 popup boxes filling the user’s screen
It looks like the messageBox can’t be updated and the user has to click “OK” to start the next camera. The reminder will go away
So does your tool do a batch render where it does multiple cameras all at once? Or does the user render a from a camera one at a time? If it’s one at a time, I don’t see what’s the problem with a messageBox.
You already got a couple of options thrown at you, maybe you should give a step by step walkthrough of how you want it to work.
Sure, I’ll explain in better detail
Right now my main rollout has 2 buttons and a dropdown list of all the cameras.
Button 1. Is for setting up Irradience Map automatically.
Button 2. Is for setting up File Save Output location automatically.
Both Buttons create the path name based on the camera’s name that is already selected.
Now, all of this is working great, but Im trying to add a second Rollout that popups when either Button 1 or 2 is pressed. The second rollout will only have text information that says what camera has been sent (saved output or irradience map). This will help prevent the mistake of sending the same camera twice. With a scene of 20 cameras, you may forget if you sent “EntranceCam02” Irradience Map or not.
With a messageBox that requires you to close the box to continue using max, closing the box defeats the purpose of having a reminder on your scene Im thinking a listbox or edittext box like you suggested at first may be the best solution.
I hope this is easier to understand. let me know if you have any questions, thanks!!
(to answer your question, its not a batch, its one at a time)
Ah gotcha, thanks for the explanation. An editText would work fine. It should be the exact same concept as my first example with the label. You could use a listBox too, but that’s something you would use for multiple objects. It really doesn’t matter though, as either one will do exactly what you need it to do.
And just for fun, if they accidently do send a camera twice, make 100 messageBox come up to say ‘Camera already sent!’ That’ll teach them to mess with you!