Notifications
Clear all

[Closed] linkable spinner

Little UI element. I might add arbitrary linkages for multiple spinners. Still trying to figure out what that would look like and a good way to link them. Maybe a photoshop layeresque version where when you select a spinner it checks all the ones its linked to.

 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