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!