I have a simple listview with buttons as items. But my ItemClicked event not firing even though onhovered event firing. Any ideas why ? Not : Using 4.25
The Button handles the click, so the widget is never informed that it was clicked, so the listview does not know about it.
Either don’t use a button, or make your own on clicked solution by having a dispatcher in the entry widget, that is called when the button is clicked. Bind to it during the Item Initialized/generated event.
I think even before what ste1nar said, the issue is: you are casting to the wrong thing.
The “Item” output on the OnItemClicked isn’t the widget, it’s the *item *that your widget is representing in the list view. If your list view is representing actors, you need to cast to “actor”, etc.
When you add the item to list view, what is the class of the object you’re adding as item? That’s what you should be casting to.
If you haven’t read this forum post, I highly recommend:
Quite long, but it explains *a lot *about ListView and TreeView. ListView widgets are not the most obvious thing unfortunately, but the item-based instead of widget-based way it’s built is actually quite convenient once you get used to it.
**However, first and foremost, try to see if the ListView is actually what you need. **If you need a list of where *each widget is linked to a specific entity, *then use list view. If you just need a list of widgets without any relationship to something else, just use a ScrollBox that has a VerticalBox or HorizontalBox, and put your widgets into those. That way you can not worry about the whole item to widget link.
Thank you very much for your replies
Hi. I was having the same issue. Here is how I solved it (The script is inside List Entry Widget)