addEarlyKeyEventHandler method
- OnKeyEventCallback handler
Adds a key event handler to a set of handlers that are called before any key event handlers in the focus tree are called.
All of the handlers in the set will be called for every key event the FocusManager receives. If any one of the handlers returns KeyEventResult.handled or KeyEventResult.skipRemainingHandlers, then none of the handlers in the focus tree will be called.
If handlers are added while the existing callbacks are being invoked, they will not be called until the next key event occurs.
See also:
- removeEarlyKeyEventHandler, which removes handlers added by this function.
- addLateKeyEventHandler, which is a similar mechanism for adding handlers that are invoked after the focus tree has had a chance to handle an event.
Implementation
void addEarlyKeyEventHandler(OnKeyEventCallback handler) {
_highlightManager.addEarlyKeyEventHandler(handler);
}