GUI radio button

6 次查看(过去 30 天)
Jason
Jason 2011-2-3
Is it possible to use the radio button to indicate if something is on or off? Right now, whne someone select the radio button it turned green. So for example, I want it to lit green when it's on and red when it's off. How would I go about changing the color of the radio button? How do I get it have to be select all the time. I couldn't find anything in help so I don't know if it's possible. If there is a better way than using radio button, much appreciate. Thanks.

回答(2 个)

Daniel Armyr
Daniel Armyr 2011-2-7
Sure you can. Just set the Value property of the radio button to 0 or 1 depending on what you want. To make sure the user doesn't change the value for you, set the Enable property to 'inactive'. That way, the radio button will look like normal, but clicking it won't make a difference.
Another way (Not tested by me) would be to place a small square panel and then change the collor from say green to red. That should be very clear to the user.

Walter Roberson
Walter Roberson 2011-2-7
I don't believe you can control the button color independently of the color of the uicontrol (unless perhaps it is possible using Java.) You can set the color of the uicontrol using the Backgroundcolor property.
Note: the uicontrol Foregroundcolor property does not control the button color: it controls the color of any text you associate with the control.

类别

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