Looping

Jeff Honken jhonken at webdsp.com
Tue Apr 18 10:28:59 EDT 2006


Thanks to all of those that helped me out on the "adding one hour" to a
variable.  Now I'm moving on further and I need to loop my times.
Looping one item is confusing to me so looping two is really tough.
Here's what I'm trying to do.  

I'm getting five inputs from fields and buttons.
1.  If it's AM or PM for start "SAmPm"
2.  The start time of the Table "STime"
3.  What Intervals the time should be incrementing in "Intervals"
4.  If it's AM or PM for the End Time "EAmPm"
5.  The finish time of the table "ETime"

What I want the program to do is take the three inputs and fill a table
with the answers until the end time has been reached.  The answers
should populate the table "MyTable" in descending order.  I know I have
to use a loop to get the results but I'm confused on how to loop both
the time and the line number of the field.  Also I'm not sure how to end
the loop at the designated end time.  Any help would be greatly
appreciated.  Jeff




on mouseUp
  put the label of btn "SAmPm" into SAmPm
  put fld "STime" into STime
  put fld "Intervals" into Intervals
  put fld "ETime" into ETime
  put the label of btn "EAmPm" into EAmPm
    
  put STime && SAmPm into currentTime
  put currentTime into item 1 of line 1 of fld MyTable
    
  convert currentTime to seconds
  put currentTime + (60*Intervals) into FutureTime
  convert FutureTime to time
  
  put FutureTime into item 1 of line 2 of fld MyTable
end mouseUp





More information about the use-livecode mailing list