PDA

View Full Version : Rollouts Construction


namoi
06-21-2007, 11:19 AM
Hi,

In a rolloutfloater with for example 2 subrollouts, is it possible to dynamically update one of the subrollout according to the changes made in the other.
For example if i have a spinner in the first rollout and change its value, i would like that another spinner in the 2nd rollout updates dynamically.

Thanks

davestewart
06-21-2007, 11:53 AM
Sure. If the subrollouts were declared as global, just reference the subrollout property as you would a rollout property.

-- in subrollout sro1
on spn changed val do sro2.spn.value = val

I'm not sure right now what the differences are (if there are any) if you're in macro-scope.

namoi
06-21-2007, 12:04 PM
Thanks,

I was stupid; i've tried it before posting but i had forgotten to DECLARE the subrollout as a global variable.

Thanks again

MoonDoggie
06-21-2007, 04:38 PM
global rlt_Main
global rlt_Sub

rollout rlt_Main (
spinner spn_Main "Value:"

on spn_Main changed val do rlt_Sub.spn_Sub.val = val
)

rollout rlt_Sub (
spinner spn_Sub "Value:"

)

thatoneguy
06-21-2007, 06:13 PM
Wow I'm on a roll of possibly applicable scripts this week from scripts I wrote in the last two weeks. Just in case you need to take your spinner linking to a whole new level:


spinners = #(0.0,0.0)
Rollout linkedrollout "Linked Spinners"
(
checkbox link12 "Link12"
radiobuttons GA_12 labels:#("Geo", "Arithmatic")
spinner spin1 "Spinner 1"
spinner spin2 "Spinner 2"

on linkedrollout open do
(
spin1.value = spinners[1]
spin2.value = spinners[2]
)

on spin1 changed true do
(
if GA_12.state == 1 and link12.checked != false then
(
if spinners[1] != 0 and spin2.value != 0 then
(
Spin2.value = ((spin1.value/spinners[1])*spinners[2])
spinners[1] = spin1.value
spinners[2] = spin2.value
)
else if link12.checked != false then
(
spinners[1] = spin1.value
)
)
else if GA_12.state == 2 and link12.checked != false then
(
Spin2.value = ((spin1.value-spinners[1])+spinners[2])
spinners[1] = spin1.value
spinners[2] = spin2.value
)
else
(
spinners[1] = spin1.value
spinners[2] = spin2.value
)
)

on spin2 changed true do
(
if GA_12.state == 1 and link12.checked != false then
(
if spin1.value != 0 and spinners[2] != 0 then
(
Spin1.value = ((spin2.value/spinners[2])*spinners[1])
spinners[1] = spin1.value
spinners[2] = spin2.value
)
else
(
spinners[2] = spin2.value
)
)
else if GA_12.state == 2 and link12.checked != false then
(
Spin1.value = ((spin2.value-spinners[2])+spinners[1])
spinners[1] = spin1.value
spinners[2] = spin2.value
)
else
(
spinners[1] = spin1.value
spinners[2] = spin2.value
)
)
)
createdialog Linkedrollout

CGTalk Moderation
06-21-2007, 06:13 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.