Gui pop up menu selection

2 views (last 30 days)
William
William on 29 Jun 2011
Hello,
I am associating a panel with four radio buttons with a pop up menu. Using the radio buttons to select different menu that could occur on the pop up menu. I have the menu choices stored in a string:
set(handles.ctqMenu, 'String', ctqString);
the index of each menu that could possible be selected is different. Once the specific menu is chosen how to I go about storing which index of that menu the user has chosen. For example if the menu options weree:
ctqString = {'Option0'; 'Option1'; 'Option 2'; 'Option3'};
So in a nutshellI am selecting a specific menu via radio buttons and now need to create a way to store which option the user chose of that selected menu.
Thank you

Accepted Answer

Fangjun Jiang
Fangjun Jiang on 29 Jun 2011
In your radio button (actually the button group since you must have 4 exclusive radio buttons) SelectionChangeFcn callback function:
Tag=get(hObject,'Tag')
switch Tag
case 'radiobutton1'
ctqString= {'Option0'; 'Option1'; 'Option 2'; 'Option3'};
case 'radiobutton2'
ctqString= {'Option10'; 'Option11'; 'Option 12'};
end
set(handles.ctqMenu,'String',ctqString);

More Answers (0)

Categories

Find more on App Building in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!