how to choose the 1st popupmenu option without having to pick it
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi guys,
I have a popup menu with several options. I want the gui to assume the first option without having to choose it. like when i initialize the gui and i want to analyse the first option, i want to not have to pick it..
i tried defining the popupmenu variables in the opening function but the gui doesn´t recognize other variables defined within that popupmenu if i don´t pick the option..
i don´t know if i was clear enough but if somebody could help i would be much appreciated!
Inês
0 commentaires
Réponses (1)
Walter Roberson
le 3 Juin 2015
You can have it positioned over the first option by setting the uicontrol Value parameter to 1.
If you also want it to take the action that would be done when the first entry is chosen, you have to call the callback yourself, such as
handles = guidata(gcf);
popup = handles.popup1; %use formal name of popup after "handles"
cb = get(popup, 'Callback');
set(popup, 'Value', 1); %choose first option
feval(cb, popup, []); %execute the popup passing the object and an empty event
0 commentaires
Voir également
Catégories
En savoir plus sur Interactive Control and Callbacks 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!