MCPcopy
hub / github.com/g3n/engine / SetKeyFocus

Method SetKeyFocus

gui/manager.go:71–83  ·  view source on GitHub ↗

SetKeyFocus sets the key-focused IDispatcher, which will exclusively receive key and char events.

(disp core.IDispatcher)

Source from the content-addressed store, hash-verified

69
70// SetKeyFocus sets the key-focused IDispatcher, which will exclusively receive key and char events.
71func (gm *manager) SetKeyFocus(disp core.IDispatcher) {
72
73 if gm.keyFocus == disp {
74 return
75 }
76 if gm.keyFocus != nil {
77 gm.keyFocus.Dispatch(OnFocusLost, nil)
78 }
79 gm.keyFocus = disp
80 if gm.keyFocus != nil {
81 gm.keyFocus.Dispatch(OnFocus, nil)
82 }
83}
84
85// SetCursorFocus sets the cursor-focused IDispatcher, which will exclusively receive OnCursor events.
86func (gm *manager) SetCursorFocus(disp core.IDispatcher) {

Callers 12

SetModalMethod · 0.95
onKeyMethod · 0.80
onMouseMethod · 0.80
activateMethod · 0.80
onMouseMethod · 0.80
onMouseMethod · 0.80
onMouseMethod · 0.80
onMouseMethod · 0.80
onMouseMethod · 0.80
onMouseMethod · 0.80
onMouseMethod · 0.80
setSelectionMethod · 0.80

Calls 1

DispatchMethod · 0.65

Tested by

no test coverage detected