I have two popupmenus in my GUI. The strings in the second popupmenu are dependent upon the selection made in the first popup menu.
In the following example, the first string property of the first popupmenu is set to [{'trial1'}, {'trial2'}, {'trial3'}].
function popupmenu1_callback(h, eventdata, handles, )val = get(handles.popupmenu1, 'value');switch val case 1 str = [{'case1'}]; case 2 str = [{'case1'}, {'case2'}]; case 3 str = [{'case1'}, {'case2'}, {'case3'}];endset(handles.popupmenu2, 'string', str);
When I select 'trial2' in popupmenu1, I am allowed to select 'case1' and 'case2' from popupmenu2. I then select 'case2' from popupmenu2. When I then select 'trial1', popupmenu2 disappears.
I also receive the following warning:
Warning: popupmenu control requires that Value be an integer within String range Control will not be rendered until all of its parameter values are valid. Warning: popupmenu control requires that Value be an integer within String range Control will not be rendered until all of its parameter values are valid.
Best Answer