-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(Double)Tappable list items #4530
Comments
I would like to be able to have a "right-click" menu on the list item, but also to be able to select the list item and apply logic when the user presses the DELETE key. Is this possible? |
I think this is a duplicate of #2551. |
I agree. Looks like a duplicate. Let’s close this in favour of the other issue. |
This is possible, if you have your list item implement Tappable and SecondaryTappable. In your Tapped handler, you can just call list.Select(itemID). In your TappedSecondary handler, you show the menu. For the delete key logic, you probably want to extend the List widget itself to provide a replacement for the TypedKey handler that handles DELETE specially, but delegates all other keys to the base List's TypedKey handler. |
#2551 mentions assigning a reference to the list and the item ID to the list item in the updateItem() func. That would work for a regular list but I'm using an untyped list and the updateItem() func for that does not pass the ListItemID, but rather the binding.DataItem. Is there no way to reference the ListItemID in this function? |
For now I'm simply creating a custom form of NewLisWithData that exposes the ListItemID to the updateItem func.
|
So close. I supplied a TypedKey handler to the custom list in order to grab the DELETE keypress as suggested, but it seems that selecting a list item by clicking on it with the mouse does not also set focus to the list so the event is never captured unless I also tab into the list, even after making a selection. |
For that last one you can focus it yourself after you call Select, using |
This seems more like a discussion, you should consider joining one of our support channels or using GitHub discussions instead of a bug report. |
Checklist
Describe the bug
When a list item satisfies TappedSecondary or DoubleTapped (and possibly others) the parent list's OnSelected method is ignored.
How to reproduce
See example code. If you comment the TappedSecondary and DoubleTapped methods, the list's OnSelected method starts working, otherwise it never executes.
Screenshots
No response
Example code
Fyne version
v2.4.3
Go compiler version
1.21.5
Operating system and version
macOS Sonoma 14.2.1
Additional Information
No response
The text was updated successfully, but these errors were encountered: