Dynamic labels
Hey there!!
i got a litte question regarding maxscript.
i`m trying to change the text of a label. i found a lot of results with google
but none of them works...
everywhere they tell to create a label:
-> label lbl_A "text"
and then "just" change the text by:
-> lbl_A.text = "new text"
but i always get "unknown property: "text" in undefined!?
anyone knows why?
greetings
Comments
Here's my two c's
You can get the text outside a rollout like so:
Play with this and see how you get on.
Hey, thanks for the answer.
Hey,
thanks for the answer. It works that way, but if I put the
"jakisLabel.text = "label text AFTER change: "" into a function, it`s unknown.
Gotta find another way...
Thx!
Greetings
If you put it in a function,
If you put it in a function, none of the rollout's content is usable(unless the function is in the rollout). The label in the rollout is similar to a variable, and you can't do anything with it outside of its scope (http://docs.autodesk.com/3DSMAX/16/ENU/MAXScript-Help/index.html?url=fil... has more about local/global scope). For example:
Unless you set a variable as global, it can only be read/written after the opening "(" and before the closing ")" which it was declared in.
Rollouts are similiar, you can't get/set values for a item in a rollout, unless you are doing that within the rollout.
There are ways to get around this, you can give the function another variable to be called with, and give it the rollout item (functions can access whatever variables they are given):
You can also access the actual rollout, but I'm not quite sure how that works, sorry.
Sorry for the long post, hopefully it helps.
hey, didn`t know / think
hey,
didn`t know / think about that rollouts have a scope!
Works now!
Thx a lot!
greetings
it should work. Check where
it should work. Check where you calling lbl_A.text = "newText"...check this and tell if its work: