← Teacher guide

A practice tracker

Students build a practice tracker in App Builder: a text input, a Save button and a total. A variable holds the total, the button's On clicked event adds to it, and a Set text action shows it. The build adds Set text last, so students see the variable change while the screen doesn't, then fix it.

App Builder apps · Apps that respond · about 60 minutes · Open the student lesson

Classroom resources

Open these in Waypoints Prepare with one click. To share a file another way, copy its address and paste it into Load URL, or download the file and import it. In Prepare, the worksheet's Teacher edition shows the answers; the student copy hides them.

Students will be able to

Timing

Try 5 min · Build (three short steps) 35 min · Check 5 min · Make it yours 15 min

Before class

App Builder runs inside the lesson page: nothing to install, no sign-in, no event limit. Each step keeps its own work in the browser, so a student who comes back carries on; Start again (press it twice) resets that step. Work is per browser and device: on a shared computer, use Save to keep a copy as a file (Open brings it back), or Share for a link to the working app.

The steps below have tick boxes that tick by themselves when the student's events match (the page reads the app as plain text). They say what to build, not how the screen looks, so layouts can differ.

The one idea: a variable remembers a number, an event changes it, and the screen only shows the new number when an event sets the text. Build 2 is the reveal: the total changes, the screen doesn't.

If students type words instead of a number, int() gives 0, so nothing is added. That's a good question for later (checking input), not this lesson.

Running the lesson

  1. Before the build (whole class, on the deck): does the total on screen change if the event only adds to Minutes? Most say yes. Leave it open until Build 2, where the screen doesn't change.
  2. Build 2: stop the class at the last step. Ask: is Minutes 45? How would we know? What did we never tell the screen to do?
  3. Check: read the Set text expression aloud together, piece by piece.
  4. Make it yours: before they build Reset, ask what would go wrong with only one of the two actions.

In class

On the slides at these points. Students can do the whole lesson on their own; these are for the room. In the deck, the Run, Modify and Make slides have the live playground in them (the tutorial link is the backup), and the notes above are in each slide's speaker notes.

The hard part (on purpose)

Finding things the first time: Properties on the right, renaming from the ⋯ menu on the left, and + Condition and + Action on the Events tab. Expect the first 10 minutes to be slow. Naming objects (SaveButton, TotalText) pays off as soon as students open the Events tab.

When students get stuck

What you will seeA question to askThe fix
Nothing happens when Save is clicked.Which object did you pick for the condition?Check the condition says SaveButton is clicked, and that the button is the one named SaveButton.
The text shows the words Minutes or & on the screen.Which parts are inside the quote marks?Only the words to show go in quotes. Minutes and the & signs go outside them.
Typing a number adds 0.What does the add action use?It should be int(MinutesInput.text), with the text input's own name if it was called something else.

Answers to the checks

  1. Read the text: Minutes is 45. The Set text action says "You've practised " & Minutes & " minutes". What does the screen show?
    You've practised 45 minutes
    Words in quote marks are shown as they are. Minutes, outside the quotes, is replaced by its value. The & signs join the pieces into one line.
  2. Find Nib's mistake: Nib's screen never changes from 0 minutes. Click the line that explains why.
    line 2
    Line 2: On start of screen runs once, when the app opens. After that nothing sets the text again, so it keeps saying 0. Nib needs a Set text action in the Save event too.

Solutions

One possible solution for each task. Other correct programs are fine.

Make it yours: Reset and sessions › A Reset button

{"version":1,"name":"Practice tracker","features":{"level":2},"variables":[{"name":"Minutes","value":0}],"screens":[{"id":"main","name":"Tracker","objects":[{"name":"Title","kind":"text","instanceVars":[],"instances":[{"id":"t1","x":229,"y":40,"w":342,"h":36,"text":"Practice tracker","visible":true,"vars":{}}]},{"name":"MinutesInput","kind":"input","instanceVars":[],"instances":[{"id":"t2","x":229,"y":100,"w":200,"h":42,"text":"","visible":true,"vars":{}}]},{"name":"SaveButton","kind":"button","instanceVars":[],"instances":[{"id":"t3","x":441,"y":98,"w":130,"h":46,"text":"Save","visible":true,"vars":{}}]},{"name":"TotalText","kind":"text","instanceVars":[],"instances":[{"id":"t4","x":229,"y":170,"w":342,"h":32,"text":"You've practised 0 minutes","visible":true,"vars":{}}]},{"name":"ResetButton","kind":"button","instanceVars":[],"instances":[{"id":"r1","x":441,"y":218,"w":130,"h":46,"text":"Reset","visible":true,"vars":{}}]}],"events":[{"id":"p1","else":false,"conds":[{"type":"onClicked","target":"SaveButton"}],"actions":[{"type":"addTo","value":"int(MinutesInput.text)","var":"Minutes"},{"type":"setText","target":"TotalText","value":"\"You've practised \" & Minutes & \" minutes\""}],"children":[]},{"id":"p2","else":false,"conds":[{"type":"onClicked","target":"ResetButton"}],"actions":[{"type":"setVar","var":"Minutes","value":"0"},{"type":"setText","target":"TotalText","value":"\"You've practised \" & Minutes & \" minutes\""}],"children":[]}]}],"device":"web"}

Make it yours: Reset and sessions › Count the sessions

{"version":1,"name":"Practice tracker","features":{"level":2},"variables":[{"name":"Minutes","value":0},{"name":"Sessions","value":0}],"screens":[{"id":"main","name":"Tracker","objects":[{"name":"Title","kind":"text","instanceVars":[],"instances":[{"id":"t1","x":229,"y":40,"w":342,"h":36,"text":"Practice tracker","visible":true,"vars":{}}]},{"name":"MinutesInput","kind":"input","instanceVars":[],"instances":[{"id":"t2","x":229,"y":100,"w":200,"h":42,"text":"","visible":true,"vars":{}}]},{"name":"SaveButton","kind":"button","instanceVars":[],"instances":[{"id":"t3","x":441,"y":98,"w":130,"h":46,"text":"Save","visible":true,"vars":{}}]},{"name":"TotalText","kind":"text","instanceVars":[],"instances":[{"id":"t4","x":229,"y":170,"w":342,"h":32,"text":"You've practised 0 minutes","visible":true,"vars":{}}]},{"name":"ResetButton","kind":"button","instanceVars":[],"instances":[{"id":"r1","x":441,"y":218,"w":130,"h":46,"text":"Reset","visible":true,"vars":{}}]},{"name":"SessionsText","kind":"text","instanceVars":[],"instances":[{"id":"q1","x":229,"y":220,"w":342,"h":32,"text":"Sessions: 0","visible":true,"vars":{}}]}],"events":[{"id":"p1","else":false,"conds":[{"type":"onClicked","target":"SaveButton"}],"actions":[{"type":"addTo","value":"int(MinutesInput.text)","var":"Minutes"},{"type":"setText","target":"TotalText","value":"\"You've practised \" & Minutes & \" minutes\""},{"type":"addTo","value":"1","var":"Sessions"},{"type":"setText","target":"SessionsText","value":"\"Sessions: \" & Sessions"}],"children":[]},{"id":"p2","else":false,"conds":[{"type":"onClicked","target":"ResetButton"}],"actions":[{"type":"setVar","var":"Minutes","value":"0"},{"type":"setText","target":"TotalText","value":"\"You've practised \" & Minutes & \" minutes\""},{"type":"setVar","var":"Sessions","value":"0"},{"type":"setText","target":"SessionsText","value":"\"Sessions: \" & Sessions"}],"children":[]}]}],"device":"web"}

Stretch and support

Stretch: Make the total read in hours and minutes once it's over 60 (hint: floor(Minutes / 60) and Minutes % 60).

Support: Pairs: one reads the step, one clicks, then swap for the Events half.

Exit ticket

A variable called Score goes from 3 to 4 when a button is clicked, but the screen still says 3. What's missing?

A Set text action in the button's event, so the screen shows the new score.

What each step is for

Where it leads

Next: Chores checklist, which makes a tick that turns on and off with sub-events and Else.

Students who go on to Construct games meet the same events and variables again, in a game.