필터 지우기
필터 지우기

Togglebutton Stuck in GUIDE GUI

조회 수: 2 (최근 30일)
TREDWISE
TREDWISE 2015년 2월 3일
편집: TREDWISE 2015년 2월 3일
Hi all,
I recently started playing with GUIs in Matlab but I ran into a problem. I created a GUI with GUIDE and inserted a button, and then converted that button into a toggle button. As soon as I did, the toggle button turned itself on and I was unable to turn it off with GUIDE (turning it off in the properties panel i.e. setting its value to 0 would revert upon saving and opening the GUI again).
I was finally able to turn it off by coding its value to 0, but once I press it in the GUI, I am unable to turn it off again. Does anyone have any insight into this problem?
There's only one toggle button, if that matters.
Thanks, John
Yes I did change the 'Style' property as Geoff asked.
The problem was that when you put a togglebutton in a button group only one can be selected at any time. I'll select Image Analyst's response as the answer because it is the closest to being right.
  댓글 수: 1
Geoff Hayes
Geoff Hayes 2015년 2월 3일
Tredwise - how did you go about changing the push button to a toggle button? Did you just change the Style property to togglebutton?

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

채택된 답변

Image Analyst
Image Analyst 2015년 2월 3일
I haven't used them but I think toggle buttons work like buttons on a blender. Only one can be down. The way to get one down is to push it. When you push one, the other pop up. So you need to add more. Why do you have only one if you want it to be a toggle button? Why don't you have it as just a regular, normal push button?
  댓글 수: 2
TREDWISE
TREDWISE 2015년 2월 3일
편집: TREDWISE 2015년 2월 3일
I just created a new toggle button at home and it works how I would expect (i.e. it stays depressed until you click it again). This is the behavior I am looking for, which is why I am using a toggle button.
However, for some reason in a different GUI I have this problem. I checked to make sure there were no references to the button's value that could potentially be causing the problem and I didn't see any.
Thanks your for your input.
Image Analyst
Image Analyst 2015년 2월 3일
Why not use a checkbox? That's what they're meant for, while a single toggle button is, I think, less intuitive for your user. Anyway, we can't debug it for you because you didn't submit any code.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by