How to change an image (icon) on button into another one image (icon) by clicking on this button in Matlab's App Designer?
12 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Temirkhan Amanzhanov
el 21 de Mayo de 2020
Comentada: Temirkhan Amanzhanov
el 21 de Mayo de 2020
Hi everyone,
This is necessary for the audio player for the play/pause button. For example, while the "play" button is pressed, an image (icon) appears on the pause button.
I don't understand how this can be added for a button. I can't find any decision to solve it. I need your help. Thank you for responce!
0 comentarios
Respuesta aceptada
Mohammad Sami
el 21 de Mayo de 2020
You will need to do this in the callback of your button.
Assuming that when you create the button, you had set the text to Play and set the Icon file to play icon image.
function ButtonDownFcn(app,event)
switch app.Button.Text
case 'Play'
% do something to play
% change the text and icon
app.Button.Text = 'Pause';
app.Button.Icon = 'Pause.png'; % path to image file
case 'Pause'
% do something to pause
% change the text and icon
app.Button.Text = 'Play';
app.Button.Icon = 'Play.png'; % path to image file
end
end
Más respuestas (0)
Ver también
Categorías
Más información sobre Convert Image Type en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!