Make a test on UI CONTROL , style popupmenu
Ältere Kommentare anzeigen
Hi everybody, i'm new on Mathswork and i have one question :
I'm making a GUI interface with lot of popupmenu (50)
i would like to make in a Button a test about these :
1 : Check the (each one) Popumenu with "ENABLE" "ON".
2: if they're ON , do a second test.
3: i would like to check if they got "blank string" i mean : a string like this < '' > just a blank without space.
4: if there is a blank : say "ERROR, select something in the popupmenu "
My popupmenu got similar name like this : Modele_1 to 10 , Type_1 to 10 etc... i got 5 name and 10 number per name. ( 5 * 10 = 50 )
I ask someone before, and they said to create a boucle FOR but i don't know how to create it. And i don't know how to make the test clearly.
i show the beginning of my code :
function Continuer_Callback(~, ~, handles)
i=1;
for i=1:10
?????
H = findobj('Style','popupmenu','Enable','on');
if H = ??
G = findobj('Style','popupmenu','String','');
if (isempty(G))
disp('Problème: case blanche');
set(handles.Continuer,'Enable','off')
end
end
end
Thank you ,and help me ....
(sorry for my English if i make some mistake)
Akzeptierte Antwort
Weitere Antworten (2)
Joakim Magnusson
am 18 Jul. 2014
Bearbeitet: Joakim Magnusson
am 18 Jul. 2014
A pop-up menu with a empty string will not be rendered, it will not be visible.
But maybe you want something like this?
% --- Executes on button press in Continuer.
function Continuer_Callback(~, ~, handles)
%I don´t understand why you want to find all popupmenus with "Enable on" but this %will do it and put them in a list
list_popupmenu = findobj(0,'Style', 'popupmenu', 'Enable', 'On');
%Iterate through the whole list
for i = 1:size(list_popupmenu)
%It's not clear what condition you want to test here
if get(list_popupmenu(i), 'String', '')
errordlg('ERROR, select something in the popupmenu','Empty pop-up menu');
end
end
1 Kommentar
Jan
am 21 Jul. 2014
"Error bla bal" is not helpful. Please post the complete message.
Hugo
am 31 Jul. 2014
Kategorien
Mehr zu Startup and Shutdown finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!