Borrar filtros
Borrar filtros

how to choose the 1st popupmenu option without having to pick it

2 visualizaciones (últimos 30 días)
Inês Mendes
Inês Mendes el 3 de Jun. de 2015
Respondida: Walter Roberson el 3 de Jun. de 2015
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

Respuestas (1)

Walter Roberson
Walter Roberson el 3 de Jun. de 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

Categorías

Más información sobre Migrate GUIDE Apps 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!

Translated by