timer working/next question
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
timer working/next question
Thanks for all the comments and suggestions on my previous posts.
I have my timer/counter working pretty much the way I want it to. The timer/counter involves a number of fields, buttons and scripts in the buttons.
all the fields and buttons are on one card in one stack. I did it this way to get it all working, with the idea in mind to move the card to another stack.
ok, so i moved my timer/counter to another card in another stack (card 2)
I want to take my result (field "counter03") and (field "counter04" on card 2) and put those results into fields on another card (card 1).
as in:
put fld "counter03" into fld "display01" of card 1 of this stack.
This seems to work, until I click my "next" button to go to card 1 and check. Then my scripts have an error. I think because I am no longer on card 2 where my timer/counter is located.
So. My question is, do I need to make my handlers and variables "global"?
can I put my various custom handler within the stack script instead of the button scripts?
comments and suggestions are appreciated.
thanks in advance,
homer
I have my timer/counter working pretty much the way I want it to. The timer/counter involves a number of fields, buttons and scripts in the buttons.
all the fields and buttons are on one card in one stack. I did it this way to get it all working, with the idea in mind to move the card to another stack.
ok, so i moved my timer/counter to another card in another stack (card 2)
I want to take my result (field "counter03") and (field "counter04" on card 2) and put those results into fields on another card (card 1).
as in:
put fld "counter03" into fld "display01" of card 1 of this stack.
This seems to work, until I click my "next" button to go to card 1 and check. Then my scripts have an error. I think because I am no longer on card 2 where my timer/counter is located.
So. My question is, do I need to make my handlers and variables "global"?
can I put my various custom handler within the stack script instead of the button scripts?
comments and suggestions are appreciated.
thanks in advance,
homer
executing at 11:12:57 PM
Type Chunk: no such object
Object Button3B
Line add myRate02/10 to fld "counter03"
Hint counter03
the button "Button3B" is the button on card 2 that starts my timer/counter
the field "counter03" is the field on card 2 that recieves the result of my button script (see below). it seems to me, I got to card 1 and the script for the button is still running, which is what I want, but now I'm on card 1, when the button is on card 2. I just don't know the script for the update.
(note: some things in the script i'm still testing and trying to figure out. for example, instead of updating every 1 second or 1/10 second, I want to make this "flexible". So I created a handler that would get the thumbPosition of another slider and then use that at my update rate. but it took off... like it divided and divided and divided. So my 'trial' code is commented out at present.
thanks for you help. see script below. I am attempting to calculate the amount of material that winds onto a spool at a given rate over time. as the timer/counter runs, the diameter grows.
here is the button script for button "Button3B"
local sRunning = false
local myRate02
global myRate03
on mouseUp
get the thumbPosition of scrollbar "Slider02"
put it into fld "myRate02A"
--put it into myRate03
get fld "myRate02A"
put it into tempVar200
if it is empty then put "1" into tempVar200
else
put tempVar200/60 into myRate02--slider divided by 60 results in ft/s
end if
put myRate02 into fld "myRate03A"--to watch variable
if not sRunning then
put true into sRunning
incFld
else
put false into sRunning
end if
updateMe03
send mouseUp to button "Button1"
end mouseUp
on incFld
if sRunning then
add myRate02/10 to fld "counter03"
--add myRate02/(1/myRate03) to fld "counter03"
put fld "counter03" into fld "DisplayLine01" of card 1
--send "incFld" to me in 1/myRate03 second
send "incFld" to me in 1/10 second
send mouseUp to button "diameter_calc01"--displays amount of material build on spool
end if
end incFld
on updateMe03
if sRunning then
set the backgroundcolor of me to "255,0,0"
set the label of me to "stop1"
else
set the backgroundcolor of me to "0,255,0"
set the label of me to "start3"
end if
end updateMe03
again, thanks for your help
homer
Type Chunk: no such object
Object Button3B
Line add myRate02/10 to fld "counter03"
Hint counter03
the button "Button3B" is the button on card 2 that starts my timer/counter
the field "counter03" is the field on card 2 that recieves the result of my button script (see below). it seems to me, I got to card 1 and the script for the button is still running, which is what I want, but now I'm on card 1, when the button is on card 2. I just don't know the script for the update.
(note: some things in the script i'm still testing and trying to figure out. for example, instead of updating every 1 second or 1/10 second, I want to make this "flexible". So I created a handler that would get the thumbPosition of another slider and then use that at my update rate. but it took off... like it divided and divided and divided. So my 'trial' code is commented out at present.
thanks for you help. see script below. I am attempting to calculate the amount of material that winds onto a spool at a given rate over time. as the timer/counter runs, the diameter grows.
here is the button script for button "Button3B"
local sRunning = false
local myRate02
global myRate03
on mouseUp
get the thumbPosition of scrollbar "Slider02"
put it into fld "myRate02A"
--put it into myRate03
get fld "myRate02A"
put it into tempVar200
if it is empty then put "1" into tempVar200
else
put tempVar200/60 into myRate02--slider divided by 60 results in ft/s
end if
put myRate02 into fld "myRate03A"--to watch variable
if not sRunning then
put true into sRunning
incFld
else
put false into sRunning
end if
updateMe03
send mouseUp to button "Button1"
end mouseUp
on incFld
if sRunning then
add myRate02/10 to fld "counter03"
--add myRate02/(1/myRate03) to fld "counter03"
put fld "counter03" into fld "DisplayLine01" of card 1
--send "incFld" to me in 1/myRate03 second
send "incFld" to me in 1/10 second
send mouseUp to button "diameter_calc01"--displays amount of material build on spool
end if
end incFld
on updateMe03
if sRunning then
set the backgroundcolor of me to "255,0,0"
set the label of me to "stop1"
else
set the backgroundcolor of me to "0,255,0"
set the label of me to "start3"
end if
end updateMe03
again, thanks for your help
homer
Here my answer in the correct place...
Hi Homer,
if Rev does not find the object(s) on the current card, why not give Rev some hints? That would be fair
Like this:
...
get the thumbPosition of scrollbar "Slider02" OF CD X
put it into fld "myRate02A" OF CD Y
--put it into myRate03
get fld "myRate02A" OF CD Z
...
send mouseUp to button "Button1" OF CD Z
...
etc
You get the picture.
Best
Klaus
Hi Homer,
if Rev does not find the object(s) on the current card, why not give Rev some hints? That would be fair
Like this:
...
get the thumbPosition of scrollbar "Slider02" OF CD X
put it into fld "myRate02A" OF CD Y
--put it into myRate03
get fld "myRate02A" OF CD Z
...
send mouseUp to button "Button1" OF CD Z
...
etc
You get the picture.
Best
Klaus
Klaus
that wont work. I have a "next" and "previous" button on my cards.
the Button03B is on card two
to do what you suggest would mean that every time I go from card 2 to card 1, I would have to put that script into the openCard script.
what if I don't want the card 2 button03b to be clicked 'every' time?
thanks anyway
homer
that wont work. I have a "next" and "previous" button on my cards.
the Button03B is on card two
to do what you suggest would mean that every time I go from card 2 to card 1, I would have to put that script into the openCard script.
what if I don't want the card 2 button03b to be clicked 'every' time?
thanks anyway
homer
-
- Posts: 179
- Joined: Sat Apr 08, 2006 11:08 pm
- Contact: