Program Multiple Choice

Use ListPicker to manage the multiple choice function of the app.

Step 1

Code the app to give the user three answer choices when they click the Choose Answer ListPicker component.

Open the AnswerListPicker drawer and drag out a BeforePicking event block. The BeforePicking event is triggered when the user clicks “Choose Answer” in the app. Program the answer choices to appear when the user clicks this button using the following code:

Step 2

Go back to the Designer editor and check the Enabled box for the ListPicker. Test the code now! What happens when you select an answer?

Step 3

Nothing happened! You need to code the AfterPicking event to check the answer to the question. Place the AfterPicking event block in the Viewer.

Step 4

Use an If statement to tell the app what to do if the answer is right or wrong. Add an If...Then... block to the AfterPicking event. Use the cog to add an Else section to this block. 

Step 5

Program the app to do the following:

  • If answer = correct answer, according to the index
  • Then change the correct label text to a message of your choice
  • Else change the correct label text to a different message

See the example code below:

Step 6

Test the code now! The app will now tell you if your answer is right or wrong!