# Makie.jl keyboard events

**URL:** <https://discourse.julialang.org/t/makie-jl-keyboard-events/62083>\
**Category:** Visualization\
**Tags:** makie\
**Created:** [May 30, 2021, 11:32am UTC](https://discourse.julialang.org/t/makie-jl-keyboard-events/62083 "2021-05-30T11:32:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [May 30, 2021, 11:32am UTC](https://discourse.julialang.org/t/makie-jl-keyboard-events/62083/1 "2021-05-30T11:32:48Z")

</div>

Hello,  
I would like to react on keyboard events in a GLMakie based app, but the way suggested in the documentation does not work:

```julia
on(events(fig).keyboardbutton) do event
    if event.action in (Keyboard.press, Keyboard.repeat)
        event.button == Keyboard.left && move_left()
        event.button == Keyboard.up && move_up()
        event.button == Keyboard.right && move_right()
        event.button == Keyboard.down && move_down()
    end
    # Let the event reach other listeners
    return false
end

```

I get the following error:

```julia
Error in callback:
type KeyEvent has no field button

```

If I print the event I see:

```julia
Makie.KeyEvent(Makie.Keyboard.right, Makie.Keyboard.press)

```

But how can I access the first element of the KeyEvent?

Any idea?

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [May 30, 2021, 11:51am UTC](https://discourse.julialang.org/t/makie-jl-keyboard-events/62083/2 "2021-05-30T11:51:09Z")

</div>

Found the answer myself: The field name is key, not button.

Should be fixed in the documentation.
