App multiscreen problem with drag and drop image sprite on canvas

Hi! I'm new here and I have a problem.
I'm building an app multiscreen with one Canvas ad more image sprites on every screen.
When I drag image sprite from x0 - y0 to x1 - y1 I see it does not persist in x1- y1 when I switch from one screen to another screen and then I return to the first screen
Is it possible to hold image sprite in x1 - y1 when I switch screen?
Thanks in advance for solution of the problem

How do you switch screens?
Try the manager screen method

Taifun

Remember where you left the sprite in TinyDB, and restore its position from TinyDB when you return to the screen with the canvas.

You only get 10 screens, so don't add too many.

Thank you very much! I'll try that.

x Taifun : Thanks to you too!

Hi, I tried to use tinydb but it didn't solve the problem..

In this simple app if I want put a fruit in the container, I want it to stay there if I go from screen 1 to screen 2 and go back.

Now I'll try to explain the problem simply with images

With the first, second and third image you can see the app and the java blocks of screen 1, I don't show the java blocks of screen 2 because they are the same as those of screen 1.

The fourth image shows how I tried to use tinydb, I'm a beginner and I've certainly made a lot of mistakes....




(Canned Reply: ABG- Export & Upload .aia)
Export your .aia file and upload it here.

export_and_upload_aia

.

drag_and_drop_two_screen_with_tb.aia (339.6 KB)

Thanks in advance for any help and sorry for the disturbing

See the circled blocks?

You got your X and Y confused in the tag.
You did this in both screens.

It's bad practice to copy blocks like this.

Also, in Screen2, instead of reopening Screen1, just close Screen2 and then you will be returned to Screen1.

In Screen1, add a When Other Screen Closed event to catch the closure of Screen2, and restore the banana position there too from TinyDB.

Also, that Banana Touched event is too early. It only catches the start of a banana drag.

Instead, use a TouchUp event to catch when you let go of the banana.

Good morning.
I tried your suggestions but it doesen't work..
The fruits do not remain inside the containers when I go from screen one to screen two and go back.
Probably I have made some mistakes .
I also specify I tried the app with block "Call Tinydb1. clear all" only with event "when screen one initialize", not with event "when screen two initialize".
I take this opportunity to introduce myself, I'm 55 years old, I live in Italy and as already mentioned I'm beginner.
I would like to do an app for children, that a simple test app.
I upload the aia file.
Thanks in advance for any help.

Greetings

Filippo

drag_and_drop_two_screen_with_tb.aia (339.7 KB)

It's important to read what you code.

Let's follow what happens here.

What is the point of trying to retrieve information from TinyDB if you have just emptied out all of TinyDB?

drag_and_drop_two_screen_with_tb2.aia (340.0 KB)

Screen1, which I fixed

Screen2, which I did not fix

Sample run:
watch my banana

P.S. I had to adjust the banana's Z value to 2 to make it appear in front of the banana container at z=1.

1 Like

Thank you very much! I don't know how to thank you!

Study this
http://ai2.appinventor.mit.edu/reference/other/manyscreens.html
before proceeding further.

Ok. Thank you👋