mirror of
https://github.com/rivo/tview.git
synced 2026-04-27 05:45:49 +03:00
[GH-ISSUE #869] Focus callback not called when a form receives focus? #631
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/tview#631
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 @adrianludwin on GitHub (Aug 23, 2023).
Original GitHub issue: https://github.com/rivo/tview/issues/869
Hi, I have a form in a grid layout, and I'd like the form to be highlighted when it has focus. For Lists, I was able to set the Focus/Blur callback to change the background colour, but this didn't seem to work for the Form. I believe this is because, while
Box.Focus()calls the callback,Form.Focus()does not.Would it be possible/advisable to call the callback in the form before passing the focus to the FormItem? After all,
Form.HasFocus()returns true if any of its items have focus, so it might make sense for the callback to be called too. But I don't know what the implications of this are, or whether Blur() would be called properly as well.@carpii commented on GitHub (Aug 25, 2023):
Facing a similar issue with flex too #870
I'll keep mine open for now, just because it contains some sample code to repro
@rivo commented on GitHub (Aug 28, 2025):
With the latest commit, the "focus" and "blur" notifications are now invoked for all primitives along the hierarchy (see
SetFocusFuncandSetBlurFuncfor details). Please have a look and let me know if this solves your problem.