Filter löschen
Filter löschen

problem clicking uitable checkbox

2 Ansichten (letzte 30 Tage)
Vincent I
Vincent I am 15 Jul. 2013
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

Antworten (1)

Vincent I
Vincent I am 15 Jul. 2013
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....

Kategorien

Mehr zu Migrate GUIDE Apps finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by