How to get the currently selected widget of a listview

Hi, I ask here because I just cant find an answer to a question that I have regarding listviews. Looked for days now on the internet and no luck.
My case: I have a listview with Text blocks that I create dynamicaly. I want to be able to click on one text block and change its color.
Here comes the weird confusing part. The index in listview is only counting the visible entries, not all of them. There seems to be no way to get the currently selected listview widget. I have the event On item clicked which gives me an Item of type object reference. But I want to get the widget itself so that I can change its color. The strange part is, there is the function Get Displayed Entry Widgets and I can iterate and change their colors but the actual selected widget is not anywhere to be found. I can get its index with Get Selected Item (again type Object, not widget that I need) → Get index of item. Works perfectly. If liestview can give the currently dsplayed widgets and the currently selected item index, why cant I get the selected widget itself? Is there anything I am missing or do I have to go some complicated route again like it seems to be to often the case with unreal blueprints.

The functions return a generic type because ListViews (and many other container-like classes) are flexible to enable different use cases. Since you know what you put in it, you can just cast it to the type that’s actually in there:


(connect the list view to the left node, connect the execution wire through the right node, and use the output of the right node to manipulate the text block)

Thanks for your reply. I tried casting but it does not work.

I have attached an image. The top green box works with casting but here I get the entry widgets of the listview and I can cast entry widget to my custom textbox TextHoverColor no problem.

In the lower red box the function GetSelectedItem for listview however does not return an entry widget but an object reference instead and that is the problem, this cast always fails.

As far as I understand the object reference is basically the object type that I use to generate the listview from in the first place. I just can´t convert it into an entry widget and TextHoverColor at all.
I think the object that is used to generate a list item and the actual list item, which is an entry widget, are decoupled and have no connection.
My object is used to feed data into the list that is used to create the list entry but there is no reference between the objec and the list entry itself.
I tried so many things with casts and there is no way.

I am annoyed by this problem because the node GetDisplayedEntryWidgets obviously can return what I need but the one selected item has no function to get it.

Yeah there’s no “one node” solution for this, but here’s a way:

  1. I presume your widget implements the IUserObjectListEntry interface (otherwise, from what I can tell, it wouldn’t be compatible with the list). If not, it should.
  2. This interface should have one blueprint overridable event: On List Item Object Set. Since not all items in the list have a corresponding widget (only the visible ones do), this event is used to notify the widget when it starts “representing” a new item. Override this event in your widget and use it to store the object.
  3. On your click event, you can now use GetDisplayedEntryWidgets and, for each, check if their stored object (the one you stored in 2.) matches the selected item. If so, set one style; if not, set the other.

Thank you again, that was very helpful.
A real headache to do something this simple, especially when coming from Unity but now it works.

I had to add a little bit. When I compare the currently visible EntryWidgets with the stored object and set them as clicked they will not reset on a new selection when the list view is scrolled and the previously clicked item is not an EntryWidget anymore. I added the comparison also on OnEntryGenerated. The logic is doubled this way but this seems to be the only way.

For anyone that has a similiar problem I attached 2 screenshots showing the build up.


Thanks again to @Kemichar for your help!