Makie.jl keyboard events

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

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:

Error in callback:
type KeyEvent has no field button

If I print the event I see:

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

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

Any idea?

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

Should be fixed in the documentation.

4 Likes