Call Function in List View from List View Item

I’m currently working on a shop-system and using a list view for my shopping cart (Warenkorb).

279765-warenkorb.jpg

279766-warenkorb-entries.jpg

The added products are actors, i read their values to set the name of my shopping cart items (Warenkorb_Item) on the “event on list item object set” function.

This works completly fine.

My shopping cart item (Warenkorb_Item) has two buttons, one for deleting it from the shopping cart and one for viewing it in a seperate window. So every item object has its own text and two buttons.

279767-warenkorb-item.jpg

Pressing the button is working and i can fire events, but i cant inform the list view (Warenkorb) that something happend from the action of the list view item (Warenkorb_Item) itself.

As i see it my problem is, i cant declare an event dispatcher onto the list view item (Warenkorb_Item) , because i only add actors to the list view but i never create a list view item (Warenkorb_Item) itself.

I dont want to pass a reference of the entire list of items to every single list view item, just so they can delete their own reference out of it and the list view updates everytime that happens.

Any ideas how to solve this?

Greetings

I kinda of solved it, i created an wrapper object (Warenkorb_Item_Wrapper) which holds the actor and added this to the shopping cart list (Warenkorb) instead of the plain actor.
The wrapper has an event dispatcher (bound to a function in the shopping list (Warenkorb) ) which can easily be called from a clicked on item (Warenkorb_Item)

Maybe their is still an easier solution to this?

1 Like

I just ran into the same problem and was going to use an interface but then I found a better solution, in the list view widget you can call Get Owning List View. I was setting it up to be able to remove items from the list view by clicking a button on the item. I have attached a pic of my setup. Hope that helps.

1 Like