フィルターのクリア

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 Center および File ExchangeMigrate GUIDE Apps についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by