Added a clarification on intercepting key events. Resolves #181

This commit is contained in:
Oliver 2018-11-26 12:36:27 +01:00
parent f13631ce74
commit 0a18dea458
1 changed files with 7 additions and 0 deletions

7
box.go
View File

@ -162,6 +162,13 @@ func (b *Box) InputHandler() func(event *tcell.EventKey, setFocus func(p Primiti
// be called. // be called.
// //
// Providing a nil handler will remove a previously existing handler. // Providing a nil handler will remove a previously existing handler.
//
// 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.
func (b *Box) SetInputCapture(capture func(event *tcell.EventKey) *tcell.EventKey) *Box { func (b *Box) SetInputCapture(capture func(event *tcell.EventKey) *tcell.EventKey) *Box {
b.inputCapture = capture b.inputCapture = capture
return b return b