mirror of
https://github.com/rivo/tview.git
synced 2026-04-26 21:35:54 +03:00
[GH-ISSUE #286] Reset form focused element to 0 #222
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/tview#222
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 @mikeschinkel on GitHub (Jun 1, 2019).
Original GitHub issue: https://github.com/rivo/tview/issues/286
First, let me thank you profusely for tview. It is empowering me to build a UI for an open-source CLI tool that I would likely never have been able to implement otherwise!
I have a flex with a treeview on the left and a form on the right. If I select a treeview node it my app changes to focus on the form. If the user selects the cancel button it returns to the treeview.
However, when the user selects the treeview node again it returns to the form with the cancel button still selected. I think it would be a better UX if the form reset to having its first element having focus. However, review the source it appears that
form.focusedElementis private and there does not appear to be a method to set it.Am I missing something obvious, or is this currently not possible with the existing feature set?
If the latter, would you accept a pull request to add this (assuming I can figure out how?)
@rivo commented on GitHub (Jun 2, 2019):
The latest commit adds a function
SetFocus()toFormand I believeform.SetFocus(0)should do what you're asking for. Cheers!@mikeschinkel commented on GitHub (Jun 3, 2019):
@rivo Wow, talks about service! Thank you for such a quick response on an open-source package.