How to "lock" UIAxes in AppDesigner?

13 ビュー (過去 30 日間)
snipsnap333
snipsnap333 2018 年 11 月 16 日
コメント済み: Cris LaPierre 2019 年 12 月 23 日
Hi,
i want to display an image in UIAxes in AppDesigner with the following code:
A = imread('icon.png');
imshow(A,'Parent',app.UIAxes);
which works fine. How can i prevent the image from being shiftable and zoomable inside the UIAxes, when trying to move the image with the mouse? It's meant to be a static logo in my GUI. I already tried:
zoom(app.UIAxes,'off');
but it doesn't change anything. I'm using Matlab 2018b.
Thanks for your help
Edit: as a workaround i put an empty Labelfield on top of the UIAxes, but this isnt a satisfying solution

採用された回答

Cris LaPierre
Cris LaPierre 2018 年 11 月 16 日
You can disable the default interactions for the axes.
disableDefaultInteractivity(app.UIAxes)
If you want them back, they can be reenabled with
enableDefaultInteractivity(app.UIAxes)
  4 件のコメント
Németh Gergely
Németh Gergely 2019 年 12 月 23 日
編集済み: Németh Gergely 2019 年 12 月 23 日
Hi Guys,
It is nice that this answer was accepted, but for me it does not work at all in appdesigner.
I use disableDefaultInteractivity(app.UIAxes) in my startup function, but it does not do anything. I tried it with button callbacks and it did not work.
Do you know something that can help?
Cris LaPierre
Cris LaPierre 2019 年 12 月 23 日
Are you wanting to do the same thing as the original poster? Namely, add an image to a UIAxes and then prevent users from shifting or zooming it? I ask because you said you tried this with a button callback.
What did you call your axes? Look in the Component Browser. If your axes is not named app.UIAxes, then you'd need to update the code with the name you gave your axes.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeEnvironment and Settings についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by