Make a test on UI CONTROL , style popupmenu
显示 更早的评论
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)
采纳的回答
更多回答(2 个)
Joakim Magnusson
2014-7-18
编辑:Joakim Magnusson
2014-7-18
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 个评论
Jan
2014-7-21
"Error bla bal" is not helpful. Please post the complete message.
类别
在 帮助中心 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!