Hi everyone,
I have a problem that I can’t seem to be able to fix. I have a TileView where I want to show a list of items inside my inventory. I have an InventoryItem widget and an ItemGrid tileview, with binding functions for the item icon, background color and text like so:
Changing the value of item value variable does nothing. I put print statements at the red X and there I have the different item type values correctly, but the only result I see is whatever is in the default value of ItemType.
What’s even stranger is that this doesn’t seem to happen if I use anything other than a listview or tileview. I tried putting a fixed uniform grid and that seemed to update correctly - so the bindings seem to work, but not if the object is inside a listview/tileview?
How do I fix this? I just want to be able to set these values after I make a widget and have it update in the list.
That’s not how lists work. You never create the widgets yourself - that’s the whole point, the list manages their lifecycle for you.
You handle the data objects the list will use to pull the data out of. If you want to update something, you update the object, not the widget, and then refresh the list.
Check out any tutorial out there. The lists are very different from regular containers. You must use the interface and consider exposing data on the objects, makes life so much easier.
Okay, so is something like this okay to do? Inside that UpdateEverything function are all the binding functions being called manually, which at least makes them display correctly now.
Hopefully you set widgets fields directly inside: Text Box -> Set Text - this way we update the widget once in an event driven approach as opposed to a function binding that runs the bound function every single frame, non-stop.