Is there a way to assign a KeyPressFcn to a button in matlab app designer?

4 views (last 30 days)
Noam Ouzana
Noam Ouzana on 13 Nov 2021
I am working on an app that has a drag and drop GUI, where I can create buttons the represents components of a system and drag them across the panel. I would like to be able to assign key commands that work while the components are being dragged, but the problem is that while dragging the focus is on the button, so the KeyPressFunction won't be activated.
I tried to maintain focus on the UIFigure with
at the end of the dragging function, but since this function is being called every time a mouse movement is detected, it slows down the app and hurts workflow.
Is there a way to assign a KeyPressFunction to the button instead, so the shifted focus won't be a problem?

Answers (0)




Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!