PDA

View Full Version : Naming the checkbutton with a GLOBAL VARIABLE ?


EricDLegare
05-19-2007, 01:59 AM
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 :D

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 :D

there is what I tried :sad:
-----------------------------------------------
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



:D :D :D Thanks for your help !

thatoneguy
05-19-2007, 03:58 AM
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)

EricDLegare
05-19-2007, 11:44 AM
Unfortunately you can't change the checkbox's label so no variable can be used to assign it.[/CODE]

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 :D

GLOBAL X = "String"
GLOBAL Y = TRUE

Rollout
(
checkbutton chk1 "test" checked:true
checkbutton chk2 "" checked: Y
chk2.caption = X as string

)

thatoneguy
05-19-2007, 08:42 PM
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

EricDLegare
05-19-2007, 09:30 PM
:D 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 :D )


Well thanks a lot :deal:

CGTalk Moderation
05-19-2007, 09:30 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.