Design Mode makes it really easy to lay out the User Interface for your app, but we'll need to dive into Code Mode to make it actually respond to users.
In Game Lab the Draw loop just constantly ran code, using conditionals to check for interactions from the user. App Lab, on the other hand, waits to respond to certain events that occur in a program. It's App Lab's way of saying "Hey! Something just happened!". This means that there doesn't need to be any code running when you aren't directly interacting with an app, and your code can respond to each of these events as they happen.
In App Lab all event handling starts by adding a special block of code called onEvent
. Here is how to do it:
onEvent
block from the toolbox into the workspace.Found a bug in the documentation? Let us know at documentation@code.org