How to use SetText with List View?
This is a simple blueprint that adds an item to a List view. It creates a simple User Widget (list item), sets a TextBlock value and Adds it to the List.
Below is an identical example but instead of adding to a list it is added directly to the viewport. The Item added to the viewport is properly updating the text. When added to the list view it is not properly updating the text.
Is this a bug or is there a proper way to initialize text? The text only needs to be initialized once on creation.
asked Aug 09 '18 at 05:15 AM in Blueprint Scripting
Ignore this post, a load of gibberish here. See Flemmard's entry instead.
This seems to be rather buggy at the moment.
When the list view creates a user widget object from its entry class, it only cares about its default variables values and will refuse to update.
So far, the only way I've found is this hackaround and even this does not really work that well:
Create widgets and feed the list an array of text:
In the List View widget, set each generated element explicitly to the new value:
It sort of works, sort of:
This does not work well because the indexes get mixed up since the list will release and regenerate new entries when they disappear and come into view again. Can be solved with better indexing but that's just not the way it's supposed to work, is it now?
I also tried to override the interface function but that just gets ignored like everything else.
Hello, I had the same issues as you all and I think I found a way to do that kinda properly.
First, the object you have to add to ListView (with AddItem) is NOT a Widget, it's like a 'Data Object'. Second, the objet type set as 'Entry Widget Class' should inherit 'UserOBJECTListEntry'. Then, in this object, you can implement 'Event On List Item Object Set', that will give you the 'Data Object' linked to this Widget. Coming from this, you can implement the SetText when needed to update the widget as the Item evolves :)
Hope this helps,
answered Aug 30 '18 at 05:49 PM
I figured out a way to update the TextBlock in ListView! I'll explain it by using your example. If you set your text in the Event Construct of ServerListItemWidget, it will work. In fact, if you create a custom event in ServerListItemWidget to set the text and call it from within the widget at any point of time, it will work. If you'll try to call this custom event in some other widget, it'll fail to update the list.
answered Aug 09 '18 at 08:57 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here