필터 지우기
필터 지우기

Use a function inside button function inside the GUI

조회 수: 1 (최근 30일)
Ioonut
Ioonut 2020년 3월 24일
답변: Ioonut 2020년 3월 24일
if I have x buttons that have to change their background colour, and some text boxes colour once clicked;
inside button_1 function, I can write:
if get(handles.button_1,'BackgroundColor') == handles.off_colour
set(handles.button_1,'Backgroundcolor',handles.on_colour); set(handles.Rtext1,'Backgroundcolor',handles.on_colour) ;
elseif get(handles.button_1,'BackgroundColor') == handles.on_colour
set(handles.button_1,'Backgroundcolor',handles.off_colour); set(handles.Rtext1,'Backgroundcolor',handles.off_colour) ;
end
how can I use a function like function react(nr) inside: function button_1_Callback(hObject, eventdata, handles)
where nr=hObject.Tag(8:end) this will be the number of the button(1 2 3 ... x) that is able to use utilise handles.(['button',nr']) handles.(['Rtext',nr'])

채택된 답변

Ioonut
Ioonut 2020년 3월 24일
oh, I just need to send the handle also like react(nr, handle)

추가 답변 (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