Progress bar question
Posted: Thu Feb 26, 2009 10:15 pm
Hi all,
I want a progress bar (0 to 100) to tick down to 0 in about 2 seconds. At a thumbPos of 0, a buzz will sound indicating an error. The way to stop the progress bar is to respond to the card with a 'y' or 'n' keypress. I've been trying this for over a day now to no avail. Source code is below. Any help would be appreciated. Thanks!
on openCard
global thisKey
set the beeppitch to 60
put the thumbposition of scrollbar "progress" into newThumbPosition
put the ticks into startTicks
repeat until thisKey = 'n' or thisKey = 'y'
--put (the ticks - startTicks) into timer
--if timer mod 500 = 0 then
put the thumbposition of scrollbar "progress" into newThumbPosition
put newThumbPosition - 1 into newThumbPosition
if newThumbPosition < 0 then put 0 into newThumbPosition
set the thumbposition of scrollbar "progress" to newThumbPosition
--end if --timer
end repeat
if newThumbPosition = 0 then
put true into tooLate
-- repeat for 1 second --until thisKey = 'y' or thisKey = 'n'
-- beep
-- end repeat
end if --0
end openCard
I want a progress bar (0 to 100) to tick down to 0 in about 2 seconds. At a thumbPos of 0, a buzz will sound indicating an error. The way to stop the progress bar is to respond to the card with a 'y' or 'n' keypress. I've been trying this for over a day now to no avail. Source code is below. Any help would be appreciated. Thanks!
on openCard
global thisKey
set the beeppitch to 60
put the thumbposition of scrollbar "progress" into newThumbPosition
put the ticks into startTicks
repeat until thisKey = 'n' or thisKey = 'y'
--put (the ticks - startTicks) into timer
--if timer mod 500 = 0 then
put the thumbposition of scrollbar "progress" into newThumbPosition
put newThumbPosition - 1 into newThumbPosition
if newThumbPosition < 0 then put 0 into newThumbPosition
set the thumbposition of scrollbar "progress" to newThumbPosition
--end if --timer
end repeat
if newThumbPosition = 0 then
put true into tooLate
-- repeat for 1 second --until thisKey = 'y' or thisKey = 'n'
-- beep
-- end repeat
end if --0
end openCard