GUI pop-up menu with checkbox
3 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
Image Analyst
2014-4-11
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 个评论
Image Analyst
2014-4-11
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.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Filter Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!