필터 지우기
필터 지우기

problem clicking uitable checkbox

조회 수: 2 (최근 30일)
Vincent I
Vincent I 2013년 7월 15일
Hi,
My goal is to have a button go from off to on, or viceversa, when a checkbox is selected in the table. However for some reason sometimes works sometimes doesnt. From what I can tell for some reason when I click on a checkbox the callback function runs twice so although the check box might be checked or unchecked the button might be on or off. Any ideas?
function inputTable_Callback(hObject, eventdata, handles)
data_table = get(handles.Data_Table,'Data');
if ~isempty(find([data_table{:,3}]==1))
set(findjobj(findobj(0,'Tag','RunScenario_Button')),'Enabled',true);
set(handles.RunScenario_Button,'BackgroundColor','Green')
else
set(findjobj(findobj(0,'Tag','RunScenario_Button')),'Enabled',false);
set(handles.RunScenario_Button,'BackgroundColor',[0.941176 0.941176 0.941176])
end

답변 (1개)

Vincent I
Vincent I 2013년 7월 15일
found my problem...
the table cell selection and edit accessed the same function
set(handles.Data_Table,'Data',data_table(:,1:6),'RowName',[],...
'ColumnFormat',{[],[],'logical',[],[],'logical'},...
'ColumnEditable',[false false true false false true],...
'CellEditCallback',@inputTable_Callback,...
'CellSelectionCallback',@inputTable_Callback)
clearly that's a no no at least in my case....

카테고리

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