필터 지우기
필터 지우기

Font of a toggle button to change on a toggled state?

조회 수: 1 (최근 30일)
Han
Han 2013년 7월 13일
Hi I am new to GUI so I guess this question is really simple.
I have tried the default matlab toggle button and it occurred to me that the "toggled" state is slightly high-lighted in blue and the distinction between it and its original state (gray) is not very obvious.
I would like to amplify the distinction. For example, something like the following would be great:
un-toggled state: A
toggled state: < A > (also bolded)
So in general, I would like to design a toggle button that bolds the string on the button. Also, the < > signs are added around the string.
Thank you very much

답변 (1개)

Dishant Arora
Dishant Arora 2013년 7월 13일
편집: Dishant Arora 2013년 7월 13일
Type the following code in Togglebutton callback:
h = get(hObject,'value');
if h
set(handles.togglebutton1, 'string', 'un-toggle','fontweight','bold')
else
set(handles.togglebutton1, 'string', 'toggle', 'fontweight','normal')
end
For more property changes, go through uicontrol properties
doc uicontrol
  댓글 수: 1
Han
Han 2013년 7월 14일
h = get(hObject,'value');
if h
set(handles.togglebutton1, 'string', 'A','fontweight','bold')
else
set(handles.togglebutton1, 'string', '<A>', 'fontweight','normal')
end
Is what I asked for exactly but I give you credit. Thanks

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

카테고리

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