From 0a18dea458148770d212d348f656988df75ff341 Mon Sep 17 00:00:00 2001 From: Oliver <480930+rivo@users.noreply.github.com> Date: Mon, 26 Nov 2018 12:36:27 +0100 Subject: [PATCH] Added a clarification on intercepting key events. Resolves #181 --- box.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/box.go b/box.go index 46df9c8..3e8b82e 100644 --- a/box.go +++ b/box.go @@ -162,6 +162,13 @@ func (b *Box) InputHandler() func(event *tcell.EventKey, setFocus func(p Primiti // be called. // // 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 { b.inputCapture = capture return b