PDA

View Full Version : ON Event Expression


Karnageddon
07-19-2009, 09:10 PM
I have been racking my brain over this and I'm sure the answer is pretty simple and I just cant figure it out right now.
I'm making an interface and the current portion I'm working on involves sliders that control objects. I have two sliders that need to be able to do the following:
-Slider1 will follow slider2 when the linking checkbutton1 is enabled
-Slider2 will follow slider1 when the linking checkbutton1 is enabled
-When checkbutton1 is disabled, both sliders will move independently

I can get the sliders to follow each other without the checkbutton, using:
on sld1 changed state do
sld2.value=sld1.value
on sld2 changed state do
sld1.value=sld2.value
but I cannot get it to work with the button
on chk2 changed state do
)
on sld1 changed state do
sld2.value=sld1.value
on sld2 changed state do
sld1.value=sld2.value
)

I know what I've done wrong in the second part but I cannot figure out how to use on events within on events. Any suggestions on how to fix it?

denisT
07-19-2009, 10:04 PM
I have been racking my brain over this and I'm sure the answer is pretty simple and I just cant figure it out right now.
I'm making an interface and the current portion I'm working on involves sliders that control objects. I have two sliders that need to be able to do the following:
-Slider1 will follow slider2 when the linking checkbutton1 is enabled
-Slider2 will follow slider1 when the linking checkbutton1 is enabled
-When checkbutton1 is disabled, both sliders will move independently




on sld1 changed val do if chk1.state do sld2.value = val
on sld2 changed val do if chk1.state do sld1.value = val
on chk1 changed state do if state do sld2.value = sld1.value

Karnageddon
07-19-2009, 10:33 PM
Worked perfectly, thank you very much Denis.

CGTalk Moderation
07-19-2009, 10:33 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.