Effacer les filtres
Effacer les filtres

Enable on/off take effect only after window resize

2 vues (au cours des 30 derniers jours)
Mika
Mika le 25 Avr 2021
Commenté : Mika le 26 Avr 2021
I use this code to disable all ui components. All workes eccept for one table. Putting a Breakpoint at the end of the function and checkig the Enable attribute of that table showes that it is 'off'. When I resize the window the display updates and the table shows grayed.
The same thing happens after I enable all the ui components. I tried to refresh the figure, I also tried to call figure(), none worked. Any idea what might cause the problem and how can I fix it?
function DisableApp(app, hExceptFor)
Child = findall(app.MyApp);
N = length(Child);
for i= 1 : N
if isprop(Child(i),'Enable')
set(Child(i), 'Enable', 'off');
end
end
if nargin == 2
M = length(hExceptFor);
for i= 1 : M
if isprop(hExceptFor(i),'Enable')
set(hExceptFor(i), 'Enable', 'on');
end
end
end
end

Réponse acceptée

Adam Danz
Adam Danz le 25 Avr 2021
Modifié(e) : Adam Danz le 25 Avr 2021
First, this is not the best approach to disabling all components. Two alternatives that are much simpler and offer easier control are,
  • Create a uipanel that contains all of the app components you want to toggle on/off. Then, just toggle the uipanel's enable property.
  • Use a uiprogressbar with the indeterminate option to disable the entire app until progress is resummed programmatically or manually.
About the problem with the uitable, it's not clear what you're seeing vs what you expect to happen. Maybe a screenshot would help. If you want the table to completely disappear, set its Visible property rather than its Enable property.
  4 commentaires
Mika
Mika le 25 Avr 2021
Thank you. I'll definatly try using panels and let you know how it worked
Mika
Mika le 26 Avr 2021
Looks like it works. Thank you

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Environment and Settings dans Help Center et File Exchange

Produits


Version

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by