When using a checkbox in a GUI how do i undo the effects of the Checkbox

조회 수: 3 (최근 30일)
I'm developing a GUI to with a loaded image, and a check-box which applies a filter, to the image. How can I get the image to become unfiltered when the checkbox is unticked is there a way of assigning a function to checking the box and assigning a function to unchecking the box?
Kind regards
Luke

채택된 답변

Adam
Adam 2016년 3월 3일
편집: Adam 2016년 3월 3일
Use a switch or if statement in the callback. That is the standard method I use for dealing with radio buttons or checkboxes. You have to check the state of the checkbox anyway to know if it has been switched 'on' or 'off' so it is just a case of programming the 'off' branch in addition to the 'on' branch.
Certainly within that switch/if statement it is better to just delegate the functionality to different functions for the different branches rather than just plonk all the code directly into the callback though.
  댓글 수: 1
Luke Dineen-Woolnough
Luke Dineen-Woolnough 2016년 3월 3일
Thank You Very Much, Ive used an If Statement that refers to the same code, when switched on as switched off, however the switched on code includes the filter process.
Works Perfectly
Thank You!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Images에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by