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

Method onKey

gui/button.go:162–177  ·  view source on GitHub ↗

onKey processes subscribed key events

(evname string, ev interface{})

Source from the content-addressed store, hash-verified

160
161// onKey processes subscribed key events
162func (b *Button) onKey(evname string, ev interface{}) {
163
164 kev := ev.(*window.KeyEvent)
165 if kev.Key != window.KeyEnter {
166 return
167 }
168 switch evname {
169 case OnKeyDown:
170 b.pressed = true
171 b.update()
172 b.Dispatch(OnClick, nil)
173 case OnKeyUp:
174 b.pressed = false
175 b.update()
176 }
177}
178
179// update updates the button visual state
180func (b *Button) update() {

Callers

nothing calls this directly

Calls 2

updateMethod · 0.95
DispatchMethod · 0.65

Tested by

no test coverage detected