How to "lock" UIAxes in AppDesigner?

13 visualizaciones (últimos 30 días)
snipsnap333
snipsnap333 el 16 de Nov. de 2018
Comentada: Cris LaPierre el 23 de Dic. de 2019
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

Respuesta aceptada

Cris LaPierre
Cris LaPierre el 16 de Nov. de 2018
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 comentarios
Németh Gergely
Németh Gergely el 23 de Dic. de 2019
Editada: Németh Gergely el 23 de Dic. de 2019
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 el 23 de Dic. de 2019
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.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Environment and Settings en Help Center y File Exchange.

Productos


Versión

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by