[Closed] Naming the checkbutton with a GLOBAL VARIABLE ?
Hey!
I’m having troubles with this :S
I’m using two GLOBAL VARIABLES, one holds a BOOLEAN VALUE and one a STRING VALUE …
When creating a checkbutton I use both the variables to create the checkbutton ( BOOLEAN for checked and STRING for name ) and what I don’t understand is that the BOOLEAN works but not the string
here is what I mean :
GLOBAL X = “String”
GLOBAL Y = TRUE
Rollout
(
checkbutton chk1 “test” checked:true
checkbutton chk2 X checked: Y
)
so basicly the TRUE transfers on the CHECKED fine, but the string won’t fit
there is what I tried 🙁
GLOBAL X = “String”
GLOBAL Y = TRUE
Rollout
(
checkbutton chk1 “test” checked:true
checkbutton chk2 (X as string) checked: Y
)
GLOBAL X = “String”
GLOBAL Y = TRUE
Rollout
(
checkbutton chk1 “test” checked:true
checkbutton chk2 name:X checked: Y
)
GLOBAL X = “String”
GLOBAL Y = TRUE
Rollout
(
checkbutton chk1 “test” checked:true
checkbutton chk2 name:(X as string) checked: Y
)
and I keep getting
– Syntax error: at keyword parameter, expected name
Thanks for your help !
Unfortunately you can’t change the checkbox’s label so no variable can be used to assign it.
The ‘solution’ is to just not call it anything and position a “label” object. Or at least that was all I could figure out last week when faced with the same dilema.
The other option is to dynamically generate the rollout, however you wouldn’t be able to dynamically update without destroying and recreating the rollout.
global checkboxname = "asdf"
execute ("
rollout "+checkboxname+" \""+checkboxname+"\"
(
checkbox chk1 \""+checkboxname+"\"
)
")
execute("createdialog "+checkboxname)
Wa ?
I mean, when I do a
on checkbutton changed state do
(
checkbutton.caption = “test”
)
this works :S
but I can’t use checkbutton.caption = “test” right under the rollout why
GLOBAL X = “String”
GLOBAL Y = TRUE
Rollout
(
checkbutton chk1 “test” checked:true
checkbutton chk2 “” checked: Y
[color=white]chk2.caption = [/color]X as string
)
caption! Aha! hahaha thanks! That’s not in the Maxscript documentation for checkbox so I could never figure out a value to call. Well then… I’m a mile and a half off on this one. I wonder why they neglected to include it under properties. Bobo?
OK well back to the problem at hand. Your code won’t operate because I don’t think you can execute code inside of a rollout except for interface objects, on … and functions.
GLOBAL X = "asdf"
GLOBAL Y = TRUE
Rollout New "1234"
(
checkbutton chk1 "test" checked:true
checkbutton chk2 "" checked: Y
)
createdialog new
new.chk2.caption = X as string
Well it seams like this works :
GLOBAL X = “String”
GLOBAL Y = TRUE
Rollout NAME
(
checkbutton chk1 “test” checked:true
checkbutton chk2 “” checked: Y
on NAME open do
(
chk2.caption = X
)
)
( I am creating and killing rollouts but I want to keep the checked and caption values of the checkbuttons )
Well thanks a lot :deal: