[GH-ISSUE #699] Inconsistency between documentation and code #510

Closed
opened 2026-03-04 01:05:36 +03:00 by kerem · 1 comment
Owner

Originally created by @us91 on GitHub (Feb 4, 2022).
Original GitHub issue: https://github.com/rivo/tview/issues/699

In the documentation for func (*Box) SetInputCapture , it is mentioned that:

"Note that this function will not have an effect on primitives composed of other primitives, such as Form, Flex, or Grid. Key events are only captured by the primitives that have focus (e.g. InputField) and only one primitive can have focus at a time. Composing primitives such as Form pass the focus on to their contained primitives and thus never receive any key events themselves. Therefore, they cannot intercept key events."

However, in the demo code presentation, the Grid page uses SetInputCapture which seems to work when Enter is pressed. This is not necessarily a bug. But some clarification on how the input capture works for composite primitives would be appreciated.

Originally created by @us91 on GitHub (Feb 4, 2022). Original GitHub issue: https://github.com/rivo/tview/issues/699 In the documentation for `func (*Box) SetInputCapture ` , it is mentioned that: "Note that this function will not have an effect on primitives composed of other primitives, such as Form, Flex, or Grid. Key events are only captured by the primitives that have focus (e.g. InputField) and only one primitive can have focus at a time. Composing primitives such as Form pass the focus on to their contained primitives and thus never receive any key events themselves. Therefore, they cannot intercept key events." However, in the demo code `presentation`, the Grid page uses `SetInputCapture` which seems to work when Enter is pressed. This is not necessarily a bug. But some clarification on how the input capture works for composite primitives would be appreciated.
kerem closed this issue 2026-03-04 01:05:37 +03:00
Author
Owner

@rivo commented on GitHub (Feb 16, 2022):

You're right. This behaviour was changed a while back but I forgot to update this part of the documentation. I just fixed that.

<!-- gh-comment-id:1041846335 --> @rivo commented on GitHub (Feb 16, 2022): You're right. This behaviour was changed a while back but I forgot to update this part of the documentation. I just fixed that.
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#510
No description provided.