[GH-ISSUE #604] desire callback when formitem receives focus #442

Closed
opened 2026-03-04 01:05:03 +03:00 by kerem · 3 comments
Owner

Originally created by @gdamore on GitHub (May 20, 2021).
Original GitHub issue: https://github.com/rivo/tview/issues/604

I have a second pane which provides additional help on screen -- ideally I'd like to have a callback that occurs when the focused item changes, so that I can provide text relevant to that particular input field. Sort like an OnFocus() function or something.

Originally created by @gdamore on GitHub (May 20, 2021). Original GitHub issue: https://github.com/rivo/tview/issues/604 I have a second pane which provides additional help on screen -- ideally I'd like to have a callback that occurs when the focused item changes, so that I can provide text relevant to that particular input field. Sort like an OnFocus() function or something.
kerem closed this issue 2026-03-04 01:05:03 +03:00
Author
Owner

@gdamore commented on GitHub (May 20, 2021):

I'd be happy to have that as a method on the FormItem, but it could also work to do do this in the Form itself.

<!-- gh-comment-id:845196743 --> @gdamore commented on GitHub (May 20, 2021): I'd be happy to have that as a method on the FormItem, but it could also work to do do this in the Form itself.
Author
Owner

@rivo commented on GitHub (May 28, 2021):

Primitive and therefore also FormItem has Focus() which is called when it receives focus. Have you tried that?

<!-- gh-comment-id:850609699 --> @rivo commented on GitHub (May 28, 2021): [`Primitive`](https://pkg.go.dev/github.com/rivo/tview#Primitive) and therefore also `FormItem` has `Focus()` which is called when it receives focus. Have you tried that?
Author
Owner

@rivo commented on GitHub (Nov 9, 2021):

Box.SetFocusFunc() exists now. Let me know if this helps you.

<!-- gh-comment-id:964269301 --> @rivo commented on GitHub (Nov 9, 2021): [`Box.SetFocusFunc()`](https://pkg.go.dev/github.com/rivo/tview#Box.SetFocusFunc) exists now. Let me know if this helps you.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/tview#442
No description provided.