mirror of
https://github.com/rivo/tview.git
synced 2026-04-26 21:35:54 +03:00
[GH-ISSUE #871] Could TableCell.SetClickedFunc callback pass a ref to *TableCell? #634
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/tview#634
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @carpii on GitHub (Aug 26, 2023).
Original GitHub issue: https://github.com/rivo/tview/issues/871
Issue #470 resulted in
TableCell.SetClickedFunc()being addedThis allows you to provide a callback fn, when a cell is clicked (even if it is unselectable)
The issue is, the callback provides no way to identify which cell was clicked (and it cannot be retrieved from
Table.GetSelection()if the cell is unselectable. Also I suspect this event is triggered before the selection would be updated anyway).This makes it very difficult to attach a generic click handler to all your header cells - for example if you wanted to install the same callback for all your header cells, then use
TableCell.GetReference()to decide how to sort the tableNot sure if I'm missing something, but is there a way to identify the cell which was clicked?
Could the tableCell be passed as a parameter to the callback fn?
@carpii commented on GitHub (Aug 27, 2023):
Good catch, thanks!
Just updating your example, since width is now returned, and callback must return a bool..