필터 지우기
필터 지우기

GUI pop-up menu with checkbox

조회 수: 2 (최근 30일)
Alon
Alon 2014년 4월 11일
댓글: Image Analyst 2014년 4월 11일
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?

답변 (1개)

Image Analyst
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
Alon
Alon 2014년 4월 11일
Hello, I have somethong like above
Image Analyst
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 CenterFile Exchange에서 Filter Analysis에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by