Home   Help Search Login Register  

Author Topic: sliders  (Read 717 times)

0 Members and 1 Guest are viewing this topic.

Bremmer

  • Guest
sliders
« on: 08 Nov 2002, 01:35:40 »
I've been messing around with dilogs, and spent about an hour pulling my hair trying to figure out why a slider I had set up wasn't interacting with a script correctly.

I finally found out that the value I set on my slider wasn't retained once the dialog was closed - the variable set by the slider position reverted to 0  (have a look at the attached example). This is an absoulte disaster!  :'(

Does anyone know how I can retain the variable after the dialog is closed?

Gameer_77

  • Guest
Re:sliders
« Reply #1 on: 08 Nov 2002, 10:10:38 »
Well, this commands might be of use:

'Dialog' - Determines true/false as to whether or not a dialog is open.

You could add something to your script like this (Not tested!):

#wait
@dialog
hint "dialog open"
slidersetposition [103, pos]
@not dialog
hint "dialog closed"
goto "wait"

 8)PEACE

Bremmer

  • Guest
Re:sliders
« Reply #2 on: 08 Nov 2002, 19:43:05 »
Cheers Gameer

Your idea sent me down the right lines of thinking. The script I was using was trying to update the slider parameter after I had closed the dialog - resulting in the parameter being reset to zero. Doh!

For the example I posted here is a script that will retain the slider value:

Code: [Select]
_slide = createDialog "Slider"

slidersetrange [103,0,1]
? not initialised : slidersetposition [103,0.5]; pos = sliderposition 103; initialised = true

slidersetposition [103, pos]
ctrlSetText [101, format["%1", pos]]

#loop
hint format ["%1",pos]
~1
? not ctrlVisible 103: goto "loop"
? (pos != sliderPosition 103) : pos = sliderposition 103 ; ctrlSetText [101, format["%1", pos]]
goto "loop"

 :)