How exactly the 'Enable' property works for GUI elements (ans is it bugged??)
Afficher commentaires plus anciens
I experienced the following behavior. Created a push button (we talk about uifigure) set its 'Enable'='off' attached a 'ButtonPushedFcn' to it.
So far so good, then i proceed to play around with my UI the button is disabled and grayed out, I click on it and nothing happens (as it should)
Then I proceed to click it again multiple times in quick succession, nothing happens (again as it should) then suddenly my callback function is called!!!!!!!!
I can reproduce this behavior and it is really confuses me, please let me know if you have any advice on the matter.
For refference:
matlab.ui.control.Button('Parent', myHandle , 'BackgroundColor', myBackground,...
'Position', myPosition ,'Enable','off', 'Text', myText,...
'HorizontalAlignment', 'center','FontName', 'arial','FontWeight', 'bold','FontSize', 11,...
'ButtonPushedFcn', @(src,event) myCallbackFcn(app,src,event,index));
function myCallbackFcn(app,src,event,index)
%%%%
end
4 commentaires
George Baltas
le 18 Déc 2018
Cris LaPierre
le 18 Déc 2018
Modifié(e) : Cris LaPierre
le 18 Déc 2018
What version of MATLAB are you using?
Can you share the rest of your code? At least enough so that the gui will appear and can be tested?
George Baltas
le 18 Déc 2018
George Baltas
le 18 Déc 2018
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Startup and Shutdown dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
