Multiple KeyPressFcn functions?
Mostrar comentarios más antiguos
Is it somehow possible to have multiple functions that get called in a figure's KeyPressFcn?
Suppose I have a function for a figure that assigns it a KeyPressFcn that performs an action when I hit the 'a' key. Now suppose I have a second function for a figure that assigns it a KeyPressFcn that performs an action when I hit the 'b' key. Ideally, I could run both functions and be able to get a response from both the 'a' and 'b' keys.
In actuality, when I run both of those functions, the last one to run overwrites the figure.KeyPressFcn property. Is there a way to get both functions to get assigned to the figure's KeyPressFcn? I tried using a cell array.
I know I could just combine both functions into one (which would also ensure there aren't keypress conflicts), but it would be nice if I could keep separate actions in separate functions (so I can mix and match depending on application).
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Interactive Control and Callbacks en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!