How to "lock" UIAxes in AppDesigner?

3 visualizzazioni (ultimi 30 giorni)
snipsnap333
snipsnap333 il 16 Nov 2018
Commentato: Cris LaPierre il 23 Dic 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

Risposta accettata

Cris LaPierre
Cris LaPierre il 16 Nov 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 Commenti
Németh Gergely
Németh Gergely il 23 Dic 2019
Modificato: Németh Gergely il 23 Dic 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 il 23 Dic 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.

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Environment and Settings in Help Center e File Exchange

Prodotti


Release

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by