(AIS) Multiple Screens Lesson
Multiple Screens
Most apps have multiple screens that contain information. You can create multiple screens in App Inventor; however, only one screen can be open at a time. Building an app with multiple screens is a lot like creating several individual apps. Every screen that you create has its own components in the Designer window.
Using Screens
To create another Screen, click the Add Screen button in the Design View. You will then be prompted to name the Screen.
This is an example of the Design View for 3 different screens.
In Screen1, Button components are created that when clicked will take you to Screen2 and Screen3. Buttons are created for Screen2 and Screen3 to go back and forth between screens as well. When the close button is clicked, it will return to the screen that opened it.
In the Blocks Editor, you will be able to see only the components of the screen currently selected. Similarly, the blocks of code related to a screen cannot refer to blocks of code in another screen.
The Control built it drawer has commands for programming the Screen.
To share data between screens you must use the TinyDB component. The components and variables in one screen are not available to another screen. You will have a TinyDB component created on each screen, but since there is only one database, they point to the same TinyDB database.
Screen.Initialized
Each screen will use the Screen.Initialize as shown in the blocks below to read the current values in the database.
Creating Procedures for Specific Events
You can also create a procedure to go to another screen and close the current screen. You need to create a parameter called screen. To create parameters for any event block, click the blue icon and drag an input into the do area. It will add a parameter that you can rename. Use the call command to execute the procedure.
[CC BY 4.0] UNLESS OTHERWISE NOTED | IMAGES: LICENSED AND USED ACCORDING TO TERMS OF SUBSCRIPTION