← App Builder apps

App Builder apps: cards

One card for each thing you'll need in App Builder, to look up while you build. Each says what it's for, how to do it, and links to the lesson that teaches it.

Apps that respond

Nothing happens? Check the screen

Each screen has its own events. If a screen's events never seem to run, they're probably on another screen.

  1. Look at the Events tab's heading: it names the screen.
  2. Click a screen's name in the sidebar to open it.
  3. Run starts on the screen you have open: open the first screen before you run.

Watch for: Under the app on the Run tab, each event lights up when it runs. An event that never lights up is a clue.

App Builder
Restart on the Events tab runs the preview again from the start of the screen.

Other apps work the same way; look for the same word in the menus. Lesson: A practice tracker

Add an event and its actions

An event is a row: on the left, when something happens (the condition); on the right, what to do then (the actions).

  1. On the Events tab, choose + Add event.
  2. Choose + Condition, then the object, then the condition, such as is clicked.
  3. Choose + Action, then the object, then the action, such as Set text.
  4. Add more actions to the same event if needed: they run top to bottom.
App Builder
Name objects before you start (SaveButton, TotalText) so you can find them in the lists. ⚡ marks a one-off event.

Other apps work the same way; look for the same word in the menus. Lesson: A practice tracker

Remember a value: a variable

A variable is a named box that holds one value for the whole app, and keeps it when the app changes screen.

  1. In the sidebar under Variables, type a name and a starting value, then +.
  2. Change it with Variables, Add to variable or Set variable.
  3. Read it by typing its name in an expression.

Watch for: While the app runs, each variable on the left shows its value now beside the value it starts at.

App Builder
Start with "" for text or 0 for a number. Rename a variable by clicking its name; every event that uses it changes too.

Other apps work the same way; look for the same word in the menus. Lesson: A practice tracker

Show a value on screen

The screen only changes when an event sets the text. Join words and values with &.

  1. Add the action: your Text object, Set text.
  2. Put words to show in quote marks: "Total: ".
  3. Join a variable with &: "Total: " & Minutes.
  4. Put it in the same event that changes the variable, or in Every tick.

Watch for: A Text input always holds text: use int(MinutesInput.text) (with your input's name) to add what was typed.

App Builder
If the screen shows the word Minutes, it's inside the quote marks by mistake. Find expressions lists everything you can type.

Other apps work the same way; look for the same word in the menus. Lesson: A practice tracker

On and off: sub-event and Else

One trigger, two branches: a sub-event runs only if its condition is true, and an Else runs only if it was false.

  1. Add the trigger on its own, such as ModeButton is clicked.
  2. Click the event, then ⋯, Add a sub-event; give it a condition and actions.
  3. Click the sub-event, then ⋯, Add an Else below; give it actions.
  4. Run it: one click runs one branch.

Watch for: Two separate events with the same trigger both run on one click and undo each other.

App Builder
Sub-events and Else need level 2 or more; a lesson sets the level for you.

Other apps work the same way; look for the same word in the menus. Lesson: A chores checklist

Keep track

Keep the screen up to date: Every tick

Every tick runs about 60 times a second, so it keeps what's on screen in step with the variables, whatever changed them.

  1. Add a condition: System, Every tick.
  2. Add actions that show values: Set text, Set width.
  3. Change variables in button events, not here.

Watch for: Don't add to a variable in Every tick: it would add about 60 a second.

App Builder
Every tick is under System. Its row on the Run tab keeps flashing: it runs all the time.

Other apps work the same way; look for the same word in the menus. Lesson: A water tracker

Check a value

A Variable condition is true while a variable meets a test, such as Glasses < Goal. Without ⚡ it's checked every time the event runs.

  1. Add a condition: Variables, then the variable, a comparison (=, <, ≥ …) and a value.
  2. Add actions; ⋯, Add an Else below for when it's false.
  3. To limit a button, put the check in a sub-event and move the action inside it.

Watch for: An action on the event above a sub-event isn't controlled by the sub-event's condition.

App Builder
To compare two expressions, use Variables, Compare … ….

Other apps work the same way; look for the same word in the menus. Lesson: A water tracker

Make a progress bar

A coloured Box whose width is worked out from a value, over a grey Box the full width.

  1. Add a grey Box at full width (say 300), then a coloured Box on top, in the same place.
  2. Every tick: set the coloured bar's width to value / goal * 300.
App Builder
Objects added later sit on top. Arrow keys nudge the selected object; Alt and arrows resize it.

Other apps work the same way; look for the same word in the menus. Lesson: A water tracker

Show or hide something

Start an object hidden, then show it from an event when it's needed.

  1. Click the object and untick Visible at start in Properties.
  2. In the event where it's needed, add the action: the object, Show.
  3. To hide it again, Hide.
App Builder
Name.visible is true while it's showing, so a condition can check it.

Other apps work the same way; look for the same word in the menus. Lesson: A water tracker

Screens and lists

More than one screen

Each screen has its own objects and events. Go to screen moves between them.

  1. In the sidebar, choose + Screen.
  2. On a button's click event, add Screen, Go to screen.
  3. Use Screen, On start of screen to set a screen's text as it opens.

Watch for: Objects on one screen aren't on the next. Use a variable in the sidebar to carry a value across.

App Builder
The Events tab shows the events of the screen open in the sidebar.

Other apps work the same way; look for the same word in the menus. Lesson: A values journal

Keep a list: list variable and List

A list variable keeps many values in order; a List object shows one on screen.

  1. In the sidebar under Lists, add a list, such as Journal.
  2. Add an entry: Lists, Add … to the end of list.
  3. Add a List object and set its Shows property to the list.
  4. count(Journal) is how many; item(Journal, 1) is the first.

Watch for: Items are numbered from 1. For each item in list runs once per item, with LoopItem and LoopIndex.

App Builder
A list can start with items: type them in the sidebar, separated by commas.

Other apps work the same way; look for the same word in the menus. Lesson: A values journal

One object

Each copy, its own values: object variables

Object variables belong to an object, but each copy keeps its own values.

  1. Click any copy; in Properties under Object variables, add them.
  2. Click each copy in turn and fill in its own values.
  3. Read one with Object.name, such as Creature.power.

Watch for: Every copy needs its values set separately.

App Builder
⋯, Duplicate in the sidebar makes another copy. Give each copy its own picture in Properties.

Other apps work the same way; look for the same word in the menus. Lesson: Creature stats

Which copy? Picking

A condition picks the copies it's true for. Actions and expressions in that event use only the picked copies.

  1. Use a condition that picks, such as Creature is clicked.
  2. Actions on that object in the same event apply to the picked copy only.
  3. Object.variable reads the picked copy's value.

Watch for: An event that picks nothing applies an action to every copy.

App Builder
Copies share one name, so Creature.name means the picked copy.

Other apps work the same way; look for the same word in the menus. Lesson: Creature stats