How to "lock" UIAxes in AppDesigner?

12 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Environment and Settings 的更多信息

产品


版本

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by