mirror of
https://github.com/rivo/tview.git
synced 2026-04-27 05:45:49 +03:00
[GH-ISSUE #525] keyboard events to primitive with table failed after commit #379
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/tview#379
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 @askovpen on GitHub (Nov 11, 2020).
Original GitHub issue: https://github.com/rivo/tview/issues/525
after commit
deb54e1422i can't get keyboards event on primitive with active table.before this commit it works fine.
@rivo commented on GitHub (Nov 17, 2020):
The internal handling of key events has changed slightly. They are now passed top-down instead of directly to the element that has focus. This also means that every Primitive must implement the
InputHandler()function (and it should also implement theMouseHandler()function). I've pasted a modification of your code that should work.However, I should note that for a simple modal menu like this, I would not suggest writing your own Primitive as you did. Writing one's own primitive is complex as you can see. And it requires you to use some "internal" functions and types (used only for custom primitives) that I cannot promise will always be backwards compatible.
Please read to the following wiki entry:
https://github.com/rivo/tview/wiki/Primitives
For your specific example, it should be much easier to instantiate a
Tabledirectly and then use its available functions to achieve your goal. If you need a primitive that contains multiple other primitives, you can useFlexorGrid.Anyway, here's the code. Please update to the latest
tviewversion to make it work.@askovpen commented on GitHub (Nov 20, 2020):
this example work, but not work in my project. how to debug, who break inputhandler event?