Ivern Nutt Code For Create Performance Task

mail@pastecode.io avatar
unknown
plain_text
a year ago
1.1 kB
2
Indexable
Never
//Tells the user what to do first.
setProperty("Output", "text", "Add Workouts...");
//The lists which hold all of the workouts which the user input in the app.
var workouts = [];
var count = 0;
//Allows the "Add!" button to add the workouts to the output page.
onEvent("InsertButton", "click", function( ) {
  appendItem(workouts, getText("InputBox"));
  setProperty("InputBox", "text", "");
  updateScreen();
});
//Lets the user see next workouts, and resets the list if the end of the list is reached.
onEvent("NextButton", "click", function( ) {
  if (count < workouts.length - 1) {
    count = count + 1;
  } else {
    count = 0; 
  }
  updateScreen();
});
//Lets the user see previous workouts.
onEvent("PreviousButton", "click", function( ) {
  if (count > 0) {
    count = count - 1;
  } else {
    count = workouts.length - 1; 
  }
  updateScreen();
});
//Allows text to show on the screen.
function updateScreen() {
  setProperty("Output", "text", workouts[count]);
  setProperty("PageNumber", "text", count + 1);
}