i have a project that runs kinda like a tomadachi and I'm trying to add a list view that shows all your pets name (the pet is a duck) but it just keeps repeating the same name
We can only guess...
Show your relevant blocks, lists etc. for building the listview.
screen 1 is the play screen fyi
You need to clear the listview of items/elements, then run the listview additems block after you have added a new name.
How do i clear a list?
This is not about the Listview.
It's about having two versions of the truth (list of duck names), and losing track of which was which.
Delete that global init of the list of duck names. It is doing you harm.
Instead, refer to the TinyDB GetValue for that directly.
Adding to the list is a special case, for which you should use a local variable in the Add Button Click event.
In that event, load the local variable from TinyDB, add your new item to it, and immediately drop it back into TinyDB. Leaving the Click event eliminates any chance of an extra variable acting as impostor to your one true value, in TinyDB.
Regarding the ListView, load its Elements list directly from TinyDB allDuckNames in the Screen.Initialize block. If not found, use Create Empty List, not blank text.
is there a way to make it so that the new things in the list view appear at the top instead of the bottom?
Instead of the add item to list block, use the Insert At Position 1 block.