It took me some time to figure out how to store and retrieve data from tinydb into dynamic textbox. You can see the attached code blocks. This is for a voice note taking app.
But now there’s a bigger dilemma. What do I do if I want to edit/update a dynamic textbox. How will it get updated into the database and how will it be retrieved when I reopen the app.
If there was a way to retrieve a list of all the dynamic textbox and their text as well as the id of the one that’s changed, it would be easy. But I dont think that’s possible.
I dont want to use listviews, labels or other methods. I want to be able to do this using dynamic textbox. Any help is extremely appreciated.
To edit/update your notes, the user have have to first display them in the textbox. To do this, let the user speak the date of the related note via speech recognizer.
The speech recognizer result would be then compared with the list stored in your database.
And if the match is found, your app will display the related note in the text box, for the user to edit/update.
But this thing seems theoretically possible. However it would be matter of trial-error practically.
All the notes are already in dynamic textboxes (as they were spoken by users). So you can just tap on one of these textboxes and edit the note. But how do you update then the database? And further retrieve the data upon reopening the app.
One way of getting the ids of dynamically created label, is by getting the index of the items(notes) you have stored in the list as well as in database.
How would you iterate over the ids of the dynamic_textboxes on the screen?
L.E.:
I mean, not only on the ids but on the dynamic textboxes themselves.
What I’d like to do is:
for each dynamic_textbox:
if dynamic_textbox[id].text != list[id].text:
then make them equal (thus, update the list and the database)
else:
do nothing.