On the Reference Manual (K4) there's an script which originally was a menu that load/save arrays and I turned it into two buttons; when the "load" button its pressed, a dialog opens up and the button is ON until the process is ended; the thing here is that if the process is cancelled on the dialog, the button doesn't change to OFF, it remains ON. What I'm missing here?
Code: Select all
on init
declare %save[2]
declare ui_slider $Slider (0,100)
declare ui_button $load
declare ui_button $save
end on
on ui_control ($save)
%save[0] := 0
save_array (%save,0)
$save := 0 {turn off the button}
end on
on ui_control ($load)
%save[0] := 1
load_array (%save,0)
while(%save[0] = 1 and $ENGINE_UPTIME - $ENGINE_UPTIME < 20000)
wait(100000)
end while
$Slider := %save[1]
%save[0] := 0
$load := 0 {turn off the button}
end on
on ui_control($Slider)
%save[1] := $Slider
end on