Hello. I’m using AppLab with my 8th grade class. I’ve used AppInventor for several years with an AP CS Principles class. I’ve found that AppLab doesn’t always react the way I want it to. For example, in the code below, I get N for the output instead of the number 1. It’s very strange as the code is so basic. I’m declaring a variable and then just adding 1 to it in the checkbox event. But, instead of just adding 1, I’m getting the letter N for the output. Has anybody ever experienced anything like this with AppLab?
And while I’m here, can anybody share how to use a dropdown list to be able to choose from a variety of screens? I’ve found some tutorials on being able to have two items in a dropdown list and then move to the screen of the second option. But, I can’t seem to find anything that would allow me to put three or more options in a dropdown list and be able to go to the screen of whatever option I choose. The code at the bottom is from some feedback I got from the CS Discoveries forum about using a dropdown list to try to do what I discuss above in this paragraph. Thank you.
var Nike = 0;
onEvent(“button1”, “click”, function( ) {
setScreen(“screen2”);
});
onEvent(“checkbox1”, “click”, function( ) {
var Nike = Nike + 1;
setText(“label5”, Nike);
if (Nike >= 1) {
setText(“label7”, “Enjoy the Nikes”);
} else {
setText(“label7”, “No Nikes?”);
}
});
onEvent(“dropdown2”, “change”, function( ) {
var dropdown_Value = getProperty(“dropdown2”, “value”);
setScreen(dropdown_Value);
});