In the App Designer: How to pass handle name to be used on other functions? Use PushButtom handle on other function?
    9 vues (au cours des 30 derniers jours)
  
       Afficher commentaires plus anciens
    
I have a frunction to adjest the properaties of a push button, so i want to pass the push button name to that function... For exaample
function ChangeColorButtonPushed(app.PushButton) %app.PushButton came from another function
    %cahnge background color
    app.PushButton.BackgroundColor = 'red';
end
%continue to callback function
so the question is How to pass the Push Button handles and use it inside the function?
I've tried this below inside the callback function but it didn't work...
ChangeColorButtonPushed(app.PushButton)
0 commentaires
Réponses (1)
  Thomas Fournier
      
 le 17 Août 2021
        
      Modifié(e) : Thomas Fournier
      
 le 17 Août 2021
  
      As long as your function has 'app' as a varargin you should be able to access your button handle.
For exemple if you want to know the coor of the button through a function:
colorbutton=ColorButtonPushed(app).
function result=ColorButtonPushed(app)
 result= app.PushButton.BackgroundColor
end
In general, "app" should always be an input of your funcitons in app designer
0 commentaires
Voir également
Catégories
				En savoir plus sur Develop Apps Using App Designer dans Help Center et File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

