Activate toggle button from pushbutton matlab GUI
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Good Afternoon All,
I have made a two "tab" GUI which is actually activated by using the visibility settings in a toggle switch of some panels layered on one another. I have tab one "Input" and tab two "Output". When I push the calculate pusbutton on the Input tab I want the Output tab to automatically show without having to physically go to the top and hitting the Output tab.
Does anyone know how to activate the toggle switch within a pushbutton function?
Thanks,
Mel
0 commentaires
Réponse acceptée
Sean de Wolski
le 7 Août 2013
Set its 'Value' to true and call its 'Callback' to the toggle button's callback:
function exampleTGL
%SCd
hFig = figure;
hPush = uicontrol('Style','pushbutton',...
'Units','normalized',...
'Position',[0.1 0.1 0.3 0.5],...
'String','Push Me!',...
'Callback',@Push);
hTog = uicontrol('Style','togglebutton',...
'Units','normalized',...
'Position',[0.5 0.1 0.3 0.5],...
'String','Toggle',...
'Callback',@tog);
function Push(src,evt)
set(hTog,'Value',true);
tog(hTog);
end
function tog(src,evt)
disp 'toggled'
end
end
1 commentaire
Sean de Wolski
le 7 Août 2013
Modifié(e) : Sean de Wolski
le 7 Août 2013
Also, to avoid reinventing the wheel:
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Install Products 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!