x

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"

Binding data to ListView

TL;DR

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
Tags:
widgets01.png (2.8 kB)
widgets02.png (43.3 kB)
more ▼

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

avatar image

SigmaSoldi3r
2 2 5

(comments are locked)
10|2000 characters needed characters left

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

Mosel3y
1.7k 48 18 65

(comments are locked)
10|2000 characters needed characters left
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