-
Book Overview & Buying
-
Table Of Contents
App Inventor 2 Essentials
By :
Right now, the InsertRow does not have any way to tell if the data that it is inserting is valid or not. For example, the user might click on the SendRSVPButton by mistake and that will insert a blank row. We can fix this by checking to make sure that the guest has typed in at least the name before we insert anything.
To achieve this, we can place all the blocks that we created within an if /then statement. The condition that we will check for is whether the NameTextBox. Text is empty or not. If the NameTextBox.Text is not empty, then that means the guest must have typed something and we will allow the insertion to happen. "If the NameTextBox.Text is empty, then the if statement is not true, and the then set of blocks will not fire. As a result, nothing will happen. The following screenshot shows the blocks for the if statement:

You can find the lime-green (unequal) block in the Build In Logic Block drawer. The block will appear with an equals sign, as...
Change the font size
Change margin width
Change background colour