Problem to store text data and image buttons

He hecho una aplicación con varias pantallas y varios botones por pantalla. Cada botón abre una página web o un documento pdf.
Quiero que se pueda cambiar el texto y la imagen de un botón que abra un documento.
Mediante el bloque When any button Clic largo tomando el componente texto y el componente imagen, consigo cambiarlo. Pero no consigo que lo guarde en tinyDB para que tome esos datos al abrir de nuevo la aplicación.
¿Pueden ayudarme?

I have made an application with several screens and several buttons per screen. Each button opens a web page or a pdf document.
I want to be able to change the text and image of a button that opens a document.
Using the When any button block Long click taking the text component and the image component, I get to change it. But I can't get it to save it to tinyDB to grab that data when I open the app again.
Can you help me?

You can do it like this:

You have to start by setting the textbox (in this case a label) with the default value, unless there is already an entry in the tinydb tag.

Then when you long click on the button, it tests for which entry is present, and switches it, and then saves the new entry to the tinydb tag

Thanks. I'll try. I don't think it solves the problem, because it would have to apply to many buttons. I will try to attach some blocks so you can see how I have it focused

In which case you can apply the basic idea using lists and the anyComponent blocks

In this way I get the text and image of the long-pressed button to change, while the program is open. But when shutting down and restarting it confuses the modified buttons (shifts them around).

You have a button frenzy!! Suggest you reconsider your workflow, and introduce lists to make life easier...

Learn about using lists:

General Tutorials

In agreement. Anyway, the program I have uploaded works fine. It is by increasing the number of screens, and therefore of buttons, that it stops working.
I will study LIST and then I will return to formulate my problem. Thanks a lot.

Anyway, what I want is that there are several screens with 16 buttons per screen. For example: 1- Press screen. 16 buttons. Each button opens a newspaper, magazine, or related document.
2-screen Cars. ! 6 buttons, and each of them opens a model, document about tires, lights etc.
3-screen Garden etc.
Each button carries a text on the content, and the image indicates if it is a video, a web page, a document, an article, an image ...
It is possible that it can be done in another way, but it would look nice that way.

Can you use one screen as a template, and change all the settings for each item depending on the view/links you want? Consider a different method to your original issue of changing the button?

Here is a sample table-based approach showing how to do this with a minimal number of screens and components ...

By screen I meant Layout Vertical arrangement. Visible or not visible. As a screen, only Screen1.
Since the first group of buttons works fine, I have tried to reproduce it in the following "screens", changing from List1 to List2. I'm trying to figure out why it doesn't work now. Thanks.

I'm using the google translator from the Spanish language, and the translation is sometimes not very good. Previously I indicated that my project consisted of a first "view" with several buttons. Pressing the first one (Press) opens another "view" with 16 buttons, each of which opens a newspaper, a magazine, or a TV. By pressing the second button (Home) of the first "view", a third view with 16 buttons opens: alarm, electricity, water, gas, wifi ...
I think it will be better understood now. Each button has an indicative text and image.
The program worked fine until it occurred to me that it could change the text and image of a button.

I believe you will need to provide a simple example project of what you are trying to achieve, and identify the problem that you are having.

I am going to upload a simple project. There are two views with 6 buttons each. Long click on a button allows to change text and image. The problem is that the text and the image that I have set by default when making the project are deleted when the program is loaded. Only changes are saved after loading the program.
How should I make the embedded text and image appear when the program is loaded? Thanks.

TOLEDO1.aia (114.8 KB)
On the PC you can see that each button has an image and a text. But that data disappears when you run the program for the first time. However, subsequent modifications save them perfectly.

Your problem might be a symptom of failure to load global values and button text and images from TinyDB in Screen1.Initialize.

Load data from TinyDB only when tag is not empty. You can do it this way.

Okay. Thanks a lot. It will surely work now. As soon as I have time I modify it to test it. Again, thank you very much.

Ok, I have tried it and it works perfect. Very good and quick solution to my problem. Thanks a lot.