mirror of
https://github.com/rivo/tview.git
synced 2026-04-26 13:25:51 +03:00
[GH-ISSUE #60] Request: Add ability to get done callback for input field in a form #44
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/tview#44
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 @mertzt89 on GitHub (Feb 20, 2018).
Original GitHub issue: https://github.com/rivo/tview/issues/60
I noticed that it is currently only possible to get the "changed" callback from an input field that is part of a form. Would it be possible to make it so that it is also possible to get a done callback?
I understand that it is necessary for the form to get a callback so that it can progress to the next field, so my thought would be that either the below snippet could be implemented to not override the "done" callback or have the done callback handler in the form perform an additional "done" callback after it does it's handling.
github.com/rivo/tview@aea500559b/inputfield.go (L170-L173)@rivo commented on GitHub (Feb 21, 2018):
I guess the way to achieve this now would be to capture the input field's input with
SetInputCapture(). The four keys thedonecallback is called for aretcell.KeyEnter,tcell.KeyTab,tcell.KeyBacktab,tcell.KeyEscape.I know this is not the exact solution you're proposing but like that, you wouldn't have to wait for me to fix this. (And it should probably be fixed in all
FormItem's.)What do you think about this?
@mertzt89 commented on GitHub (Feb 21, 2018):
I just tested your suggestion and it suits my needs. Thanks!