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

Method onKey

gui/image_button.go:200–215  ·  view source on GitHub ↗

onKey processes subscribed key events

(evname string, ev interface{})

Source from the content-addressed store, hash-verified

198
199// onKey processes subscribed key events
200func (b *ImageButton) onKey(evname string, ev interface{}) {
201
202 kev := ev.(*window.KeyEvent)
203 if evname == OnKeyDown && kev.Key == window.KeyEnter {
204 b.pressed = true
205 b.update()
206 b.Dispatch(OnClick, nil)
207 return
208 }
209 if evname == OnKeyUp && kev.Key == window.KeyEnter {
210 b.pressed = false
211 b.update()
212 return
213 }
214 return
215}
216
217// update updates the button visual state
218func (b *ImageButton) update() {

Callers

nothing calls this directly

Calls 2

updateMethod · 0.95
DispatchMethod · 0.65

Tested by

no test coverage detected