GUI pop-up menu with checkbox
3 views (last 30 days)
Show older comments
I have a frequency band that divided to 3 little bands. When I pick from the popup menu (for example) band 1 I need to pick up which song I want to filterize. When I pick up the next band I want to reset the previous check on the checkboxes
But when I want to pick up the new check and do my calculations(in the popup menu Callback) the program goes to checkbox1 callback. what can I do?
0 Comments
Answers (1)
Image Analyst
on 11 Apr 2014
What do you mean "pick up the new check". Perhaps a screenshot would help. I'm envisioning a listbox where all your songs are listed. The user clicks one, then the waveform and its spectrum are displayed in plots. Then the user checks any of 3 possible checkboxes. Finally user selects some operation from popup1 and it runs the callback. So the callback would check the checkboxes before it proceeds. So in the callback:
% Get the state of all 3 checkboxes:
valueOfCheckbox1 = get(handles.chkFreq1, 'Value'); % User wants to process freq band 1.
valueOfCheckbox2 = get(handles.chkFreq2, 'Value'); % User wants to process freq band 1.
valueOfCheckbox3 = get(handles.chkFreq3, 'Value'); % User wants to process freq band 1.
% Now find out which operation the user wants to do.
% Get the item selected in the popup.
selectedPopupItem = get(handles.popOperations, 'Value');
if selectedPopupItem == 1
% Some code to do operation #1
elseif selectedPopupItem == 2
% Some code to do operation #2
elseif selectedPopupItem == 3
% Some code to do operation #4
end
3 Comments
Image Analyst
on 11 Apr 2014
OK. My code will work for that. As you can see, and hopefully have tried already, when you select a popup item, it calls the popup callback (which is my code) and then gets the popup item you selected, and which checkboxes you selected, then you have everything and can do whatever you want.
See Also
Categories
Find more on Filter Analysis 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!