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"

How to use SetText with List View?

Blueprint Example 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. PIE Result 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.

Product Version: UE 4.20
more ▼

asked Aug 09 '18 at 05:15 AM in Blueprint Scripting

avatar image

51 1 6 6

avatar image lollalol Aug 09 '18 at 06:06 AM

Hey. I did a small test. It turns out that the value of the text actually gets updated in the variable, but not graphically in the list view. Try looking into how to refresh the list visually. I'm looking into the same. The value is definitely being updated, but the listview is showing you stale values

avatar image Raisonbran648 Aug 09 '18 at 06:22 AM

If you use an event tick to print the value it is Text Block instead of the desired set value.

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

4 answers: sort voted first

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:

alt text

In the List View widget, set each generated element explicitly to the new value:

alt text

It sort of works, sort of:

Image from Gyazo

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.

create.png (180.4 kB)
list.png (111.1 kB)
more ▼

answered Aug 09 '18 at 07:54 AM

avatar image

15.2k 77 25 62

avatar image Raisonbran648 Aug 09 '18 at 08:23 AM

Your top two images failed to embed. Could you post the second photo or elaborate how you are setting each generated element explicitly to the new value?

avatar image Everynone Aug 09 '18 at 08:29 AM

Done. Thanks!

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

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,

more ▼

answered Aug 30 '18 at 05:49 PM

avatar image

46 2 5

avatar image Everynone Aug 30 '18 at 05:51 PM

That actually sounds promising, I'll give it a go!

avatar image Flemmard Aug 30 '18 at 05:57 PM

alt text This is what appens in my class set as 'Entry Widget Class' (i know the Event Tick is a bit overkill, but after an hour or so trying to figure out wtf is going on .. :D) This explains also how you can actually fill the function 'GetListItemObject' i guess

sample.png (106.7 kB)
avatar image Everynone Aug 30 '18 at 06:03 PM

So, essentially, the list view controls the whole lot, it's fully responsible for creating and setting its objects' data. Fair enough. As soon as I find some time, I'll take it for a spin for the sake of getting it to work so I can tick it off my mental list of things that I think are broken.

I'll edit my rant post, too. Perhaps @Raisonbran648 can accept this answer instead. Thanks again for looking into this!

avatar image Flemmard Aug 30 '18 at 06:13 PM

No problem, I had the same problem too and I always got on this post ... so I guess it would be the time to answer here. I hope i dont lead you in a bad direction, that it's the way to do .. but as it seems as noone made it work .. it'll do it :)

avatar image Everynone Aug 31 '18 at 02:11 PM

First, the object you have to add to ListView (with AddItem) is NOT a Widget, it's like a 'Data Object'.

Can you show what you're actually adding to the list?

avatar image Flemmard Aug 31 '18 at 02:17 PM

I'm adding a simple C++ UObject, anything will work as ListView will just give it to you so you handle it. alt text alt text

(Note the Expand, it's because I now use TreeView (similar to ListView)

additem.png (83.2 kB)
object.png (16.4 kB)
avatar image Everynone Aug 31 '18 at 02:40 PM

Phew! I got it to work with C++ when (after!) I talked to OReillyEnt. Although, I did not like what I did there. Your method is just neat.

I was wondering what kind of object I could pass in pure BP. I got it to work by constructing a Primary Data Asset.

Again, thanks!

avatar image Flemmard Aug 31 '18 at 03:05 PM

No problem :) Nice it helped you doing things a bit cleaner. What kind of game are you developping ? :)

avatar image minnow Sep 01 '18 at 11:24 AM

Hello. If I want to remove a item in list view, What should I call function?...


I think list view and scroll box are similar. but list view is more efficiently performence. When should I use list view?...

avatar image Quentindefou Jul 02 '19 at 02:36 PM

Hello Minnow, I know it has been almost a year but did you find any solution for removing an item from the list view?

avatar image MarkcusD Jan 26 '19 at 07:54 AM

This helped thx.

avatar image Tyrius Jun 07 '19 at 10:35 PM

Do you know what "UserListEntry" interface is used for? Which class should implement it?

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

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.

more ▼

answered Aug 09 '18 at 08:57 AM

avatar image

21 3 9

avatar image Everynone Aug 09 '18 at 09:06 AM

Could you demonstrate how you populate the ListView with several entries, each with unique text?

avatar image Raisonbran648 Aug 09 '18 at 09:11 AM

This is not correct. The blueprint I posted is setting the text inside the construct event and it does not work. I'm not following.

avatar image Everynone Aug 09 '18 at 09:16 AM

This does not work either:

alt text

It prints fine, though.

capture.png (170.0 kB)
(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Your almost there @Everynone. What you need to do is call GetIndexForItem() on the widget your getting from the EntryGenerated Function. This will give you the proper index to feed into your data array

more ▼

answered Aug 28 '18 at 02:35 PM

avatar image

21 1 1

avatar image Everynone Aug 28 '18 at 03:07 PM

Hm, I added a comment to your message but you moved it? It disappeared. Some time ago I made it work OK with manual indexing since GetIndexForItem() returns -1 for valid children. Not sure about C++.

Besides, this surely is not the correct way to use the List view. Awkward much?! :D

avatar image OReillyEnt Aug 28 '18 at 03:29 PM

I completely agree about the usage. 80% of the time I think it makes more sense to create custom solutions rather than figure out Epic's intended usage. I realize why it returns -1. I told you the wrong thing, it wont work in blueprint that way... what you need is the underlying UObject index not the widget because the UObject array remains intact unlike the Widget array. I'll look into it and get back to you

avatar image Everynone Aug 28 '18 at 03:32 PM

No worries, I know that Listview creates its own widgets and disregards everything else, that's the reason it does not work. Because I believe it does not work as intended at the moment.

avatar image OReillyEnt Aug 28 '18 at 03:37 PM

no it works perfectly for me in C++ because i can intercept the OnGenerate Function and get both the UObject and the Widget. im trying to think of how to do it in BP

avatar image OReillyEnt Aug 28 '18 at 03:53 PM

Try OnItemScrolledIntoView - that gives you both the item and the widget. Then call getobjectindex on the Item not the widget. I avoid BP like the plague so its not my strongpoint

avatar image Everynone Aug 28 '18 at 04:11 PM

Thanks for trying but that's not the point.

I do not have the project (I was proving the point in my original answer) and I am reluctant to set it up again since I know UMG well enough to tell when things are fishy. (or that the time spent setting it up and making it work is a poor payoff). It's not the first time I'm hitting UMG limitations/bugs.

I mean, the very fact that the list view ignores the widget added to the panel and creates its own instance from defaults tells one a lot about the functionality. Whether it's indented or not.

Lets say I want to add an instance of a widget to the list view dynamically. I will feed the list a fancied up child but that will get ignored because the list view will then create its own version from class defaults. So I need to find in the list and push the data back it again? No, thank you. :|

Don't even get me started on trying to insert widgets into panels.

For the sake of clarification, this does absolutely nothing in BP, for example:

alt text

I am under the impression that this widget shouldn't have been exposed to blueprints in 4.20. On the other hand, if this is the intended functionality, I do not wish to have anything to do with this widget :)

capture.png (28.5 kB)
avatar image OReillyEnt Aug 28 '18 at 04:15 PM

Agree with everything you said. I assume Epic did it that way for performance reasons when there are like 200 widgets in a list, but I hate it too. If I had the time I would convert to Neosis

avatar image Everynone Aug 28 '18 at 04:19 PM

Again, thanks for looking into this! Good to know this is working in Slate.

(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