Is there a way to assign a KeyPressFcn to a button in matlab app designer?
3 ビュー (過去 30 日間)
古いコメントを表示
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
figure(app.UIFigure)
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?
0 件のコメント
回答 (1 件)
Divyanshu
2024 年 2 月 28 日
Hi Noam,
A possible workaround for your use-case can be to make use of 'WindowButtonMotionFcn' because this callback is triggered or attached to the movement of Mouse Pointer.
Since you are dragging the buttons and moving them in the UIFigure, you can try this callback.
Please refer the following documentation for further details:
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Develop Apps Using App Designer についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!