mirror of
https://github.com/rivo/tview.git
synced 2026-04-26 13:25:51 +03:00
[GH-ISSUE #39] SetDoneFunc doesn't seem to work when the inputField is inside a Form #32
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/tview#32
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 @radisb on GitHub (Jan 21, 2018).
Original GitHub issue: https://github.com/rivo/tview/issues/39
(Sorry if it is something very obvious, but I am very new to golang so maybe I miss something. )
In the code above, when I press Enter, the app stops only with the second container line (inside a Flex). If I use the first container (the Form) nothing is happening. Is this by design?
@rivo commented on GitHub (Jan 21, 2018):
Actually, this is by design. Check out the documentation for
AddFormItem():I don't specify exactly what's being overridden because it's different depending on the type of form element. But the
donehandler is definitely overridden by theFormclass (your own handler will be dropped).The reason for this is that if such a field is embedded in a form, the desired behaviour is to move on to the next field when the user presses Enter (or Tab). If you insist on quitting the application (or anything else) when user presses Enter, you can use
SetInputCapture()on your input field to override key events.@radisb commented on GitHub (Jan 22, 2018):
Got it. Thanks for your answer.
On Sunday, January 21, 2018, rivo notifications@github.com wrote:
@joegrasse commented on GitHub (Apr 18, 2018):
@rivo I just discovered this as well. It would be nice if the Docs for SetDoneFunc on the form items called this out as well.
@rivo commented on GitHub (Apr 19, 2018):
FYI, I've separated the "done" function from the "finished" function so if your primitive is part of a form, your own "done" callback won't be overwritten anymore.
@felipeluna commented on GitHub (Feb 25, 2019):
Hi, If I have this
the behaviour is to go to the next item in the form, not to set focus where i want. Is there any reason for this? How can i override the "Done" keys in a input field?
In my application i have several forms, ( because i couldn't figure out how to organize the input fields the way i want)
I like the cycle behaviour, but i would like to go to the next form when I'm done with the latest inputfield.
Thanks
@rivo commented on GitHub (Mar 9, 2019):
Have you tried returning
nilfrom within yourifstatement?