Untitled
unknown
plain_text
3 years ago
1.1 kB
12
Indexable
//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);
}
Editor is loading...