Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Binding data to ListView


How do I feed the data into the generated child widgets?

What I've tried / done so far:

(I refer to this widget, if you're wondering)

List view in the menu

I have a widget called item (Will be the children in the List View) that needs to display two data attributes from my list.

"Binding" data to a List View widget seems pretty straightforward, you just call set List Items and you're supposedly ready to go:

set list items call

But the problem is that the list view does not know how to translate the data from the list into the widgets. Even tho that item implements User List Entry or User Object List Entry (Tested both) I've found no way to tell the item to widget to translate the data, or even receive it.

Disclaimer: I already know that you can make a scrollable list by placing widgets, this is about List View widget.

Product Version: UE 4.20
widgets01.png (2.8 kB)
widgets02.png (43.3 kB)
more ▼

asked Jan 03 '19 at 08:37 PM in Blueprint Scripting

avatar image

2 1 3 6

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

You don't add the widgets to the list directly, instead you create an Object blueprint which will contain the data you want. And when adding an item to the list you construct that object and add it. For it to use your widget, set the Entry Widget Class, to your widget, in the details panel of the List View

So, make a new Blueprint class, pick Object as its parent class (not Actor). In this class add all the variables you need. Set them as Editable and Exposed On Spawn:

alt text

Then, in your widget which will be the entry, make sure you have implemented the User Object List Entry interface. In the event graph, right click and find the "Event On List Item Object Set". The object passed in this event is the one you created above, but you'll need to cast it to your class first to access the variables. You can then use those variables to set the text in your widget or whatever you want to do with the data. Like this for example:

alt text

And finally, to actually add entries you use Construct Object, construct an object of the the same class you created above, here you can plug in whatever values you want, and then use Add Item to add it your list. The List handles creating the widgets themselves, it just needs the data.

You could probably iterate through your inventory items and construct add the data objects like I did here:

alt text

I'm using tile view but it's the same idea. I have found the selection bit of tile views are a bit buggy though, at least in 4.21.

lv1.jpg (39.6 kB)
lv2.jpg (110.2 kB)
lv3.jpg (158.2 kB)
more ▼

answered Jan 03 '19 at 08:54 PM

avatar image

1.8k 49 20 67

avatar image okanerenli Mar 03 '19 at 12:36 PM

This is the best explanation of usage of list view.Thanks so much..

avatar image Veer Apr 25 '19 at 09:43 AM

Does anyone know how to reflect any updates made to the objects create like above to the widgets using them?

avatar image northgaterebel May 09 '19 at 01:34 PM

Yes there is indeed! I struggled with updating the list for a while and finally stumbled across this easy to miss function: Set List Items. It sets the list to pull from an array of data objects instead of adding them directly. Simply update the data variable on the object in the array and call the Regenerate All Entries function on the list view. It updates the list view! Another method I got working is calling custom events on the object and passing params to update individual fields. The way to do this is to pass the ref of the list item widget back to the data object by setting a public variable on the data object during Event On List Item Object Set. Then use the ref in the variable to edit any fields or bound variables you made public in the list view widget. It is a bit complicated but it's another option.

avatar image Veer May 09 '19 at 02:20 PM

Thanks! This is exactly what I did as well.

avatar image northgaterebel Jun 03 '19 at 05:21 PM

Cool! In the end though I had to abandon the list view and use a scroll box instead. Implemented game pad navigation of the list (to allow the player to use D-Pad up/down) by way of button events and some simple math. It works as expected but the list view Scroll Index Into View function offers no scrolling animation and always puts the index at center, creating a harsh and unnatural scrolling experience, especially when using press-and-hold navigation acceleration. The scroll box uses animated smooth scrolling and keeps the selected item at the edge of the list as seems customary. Maybe the list view is best suited for mouse-only applications.

EDIT: I learned the scroll box has a hard limit nearabout 200 items beyond which FPS loss occurs for the entire game whether the scroll box is visible or not. Yikes! I need potentially longer lists for my looter shooter so I returned to the list view. Not yet defeated I painstakingly figured out complex blueprints to create fake scrolling by means of maintaining only the list items visible on the screen, refilling the list view upon each scroll event and playing translation animations inside the list view widget to trick the eye into believing the list scrolled. And it works fluidly! No FPS loss. We can have it all! :D

avatar image Tyrius Jun 07 '19 at 06:33 PM

Please excuse my curiosity, what did you end up using? A listview but with "custom scrolling"? The "maintaining only the list items visible on the screen" sounds like a workaround for the scrollview limitation, while the custom scrolling sounds like a workaround for the listview.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question