How to control the visibility of the panels through radio buttons?
1 回表示 (過去 30 日間)
古いコメントを表示
Vinothkumar Sethurasu
2021 年 11 月 22 日
コメント済み: Vinothkumar Sethurasu
2021 年 11 月 22 日
I am using radio buttons on button group to control the visibility of the uipanels.
Once i switched ON the visibility of a panel through a particular radio button (through callback fn), it need to be switched off when another panel is switch ON through another radio button.
I have an idea to switch OFF visibility of a created panel when another panel appears through below command,
if get(handles.radiobutton1,'Value')==1
set(handles.uipanel1,'Visible','On');
set(handles.uipanel2,'Visible','Off');
set(handles.uipanel3,'Visible','Off');
set(handles.uipanel4,'Visible','Off');
set(handles.uipanel5,'Visible','Off');
set(handles.uipanel6,'Visible','Off');
set(handles.uipanel7,'Visible','Off');
end
Likewise, on another callback function of a radio button, the visility of another panel is switched ON & all others set to visibility OFF.
My question - Is there any smart way to reduce the number of code lines? since i have many uipanels to control.
0 件のコメント
採用された回答
Yongjian Feng
2021 年 11 月 22 日
編集済み: Yongjian Feng
2021 年 11 月 22 日
create a funciton that sets everything to OFF.
Call this function first, and then just set only the one you want to ON.
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!