Hi everyone,
I basically don't understand why I can't save the button's BackgroundColor in TinyDB and retrieve it in the Initialize event.
Regards
Nicola
What Initialize event?
I don't see one.
You should check what's stored in TinyDB, set label text get TinyDB get value tag=Nunzia
or put color block directly and check
Neither do I. It should work.
I have had a little time to guess what is going on between the developer's ears based on the supplied code.
Tell me if I am wrong.
The two buttons are really a pair of radio buttons, meant to display a choice between
- Maria
- Nunzia
- Neither one
I guess this based on how the two buttons swap their background colors.
Since your Button Click events change the background colors of two buttons, they should have stored the colors for both buttons, not just a single button.
That would require an extra TinyDB call in each event.
Logically this should have been represented by a single TinyDB tag 'personName', with possible values 'Maria', 'Nunzia', or a default of ''.
At Initialize time, the single tag should be interrogated, and both buttons' back ground colors should be set for each of the three possible TinyDB values.
Here is another possibility, which I have not yet explored.
When we Click an AI2 Button, there is an animation of the Button, possibly changing its background color momentarily.
Could that be manifesting itself in the Click event?
(I don't know yet.)
He just wants to try when a button click the Bg color to be changed to Green so that be recognized ON, and stores that in TinyDB then when app re-opens then get it from TinyDB what was previously ON. However there is no Screen Initialize event I think because he first trying to check whether such method works or not.
I tested my button feedback hypothesis, and found no effects on background color capture in the Click event:

button_background_color_tests.aia (2.4 KB)
I see a feedback effect in both Buttons, though I turned feedback off in the second button.
That's a different story, though.
Here is sample code for saving and restoring button background colors in TinyDB.
It requires a list of button components, hard wired in a global variable.
You can't save components in TinyDB, but you can save a list of colors matching the colors of the hard wired button component list.
button_background_color_tests (1).aia (4.1 KB)
P.S. This is a shorter way to walk two lists in parallel:
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.





