Run code for screen 2 in AppLab

How do you run code for screen 2 in AppLab without having to use design mode. Lets say I want to customized screen 2 by putting a dot(25). How do I get that on screen 2. It only comes up in screen 1?

@paulruizdevelasco
The turtle is limited to screen1. I’m not sure exactly what you mean by customize but the other elements like button and label can be 'created for screen2. You may want to try using a canvas.

Happy computing,
Andrea

/**

  • The screens programmatically switched need to be created in the deisgn tab.
    */
    textLabel(“screen1Label”,“Screen1”);
    setScreen(“screen2”);
    textLabel(“screen1Labe2”,“Screen2”);

@paulruizdevelasco, the dot function is a turtle command which only works on the first screen (it is a little quirk of the AppLab environment… I have asked why in the past and I got a fairly technical explanation which in summary was “it’s really a lot of work to get it to show up on multiple screens from an engineering perspective”).

What is the desired effect? There might be a work around… OR you could try the canvas element!

Happy programming!
KT

1 Like

@zsawyer Does that mean I cannot run code? I want to create a custom background. For example I would like to run the following code for screen 2.

//Call 4 cirlces with random points
penUp();
moveTo(randomNumber(0,250), randomNumber(0,350));
drawCircle(40,2);
moveTo(randomNumber(0,250), randomNumber(50,250));
drawCircle(60,5);
moveTo(randomNumber(0,250), randomNumber(250,250));
drawCircle(80, 10);
moveTo(randomNumber(0,25), randomNumber(200,350));
drawCircle(100,20);
//Define function that draws a circle
function drawCircle(length, thickness) {
penDown();
penRGB(randomNumber(50,255), 0,0,.3);
//penRGB(0,randomNumber(50,255), 0,.3);
//penRGB(0,0,randomNumber(50,255),.3);
penWidth(thickness);
arcRight(360, length);
penUp();
}
hide();

@paulruizdevelasco

You will have to find another way to customize the background of screen2 since the turtle is not available.

Happy computing,
Andrea

For the record, and as a point of clarification, the turtle can only work on one screen, but it doesn’t necessarily have to be “screen1”. Turtle works on whatever is set to be the “default screen” - you can make a screen the default (the screen that shows first when the app is run) by clicking the “Make Default” button in the screen properties dialog in Design Mode.

This doesn’t change any of the points above. Just sayin’.

–B

@paulruizdevelasco If you like the screen that is drawn with the turtle commands, I’d suggest running the program, capturing a screenshot of the screen and putting that in as the background for your subsequent screens.