Notifications
Clear all
[Closed] 2 different states in a $
Jan 02, 2009 3:16 pm
Hi, I was wondering who i could know if in a $ of 3 obj, a property has a different state.
obj01.xray = true
obj02.xray = false
obj03.xray = true
if i do,
obj01.xray
it will return
true
and if i select all of them and do
$.xray
it returns
-- Unknown property: "xray" in $selection
but if do
$.xray = true
it will change all the xray properties in true
i need to know it because i would like to disable a label if they have a different state
2 Replies
Jan 02, 2009 3:16 pm
Assigning a property one level deep is a MAPPABLE function, so $.xray = true is valid for one or more objects. GETTING a property from more than one object is NOT a mappable function, so you cannot do that. You have to LOOP yourself and check the count of those that have XRAY checked against the count of the selection.
rollout test "Test"
(
checkbox chk_myCheckbox "XRay"
button btn_test "Test"
on btn_test pressed do
(
theCount = (for o in selection where o.xray == true collect o).count
case of
(
(theCount == 0): chk_myCheckbox.triState = 0
(theCount == selection.count): chk_myCheckbox.triState = 1
(theCount < selection.count): chk_myCheckbox.triState = 2
)
)
)
createDialog test