Borrar filtros
Borrar filtros

problem clicking uitable checkbox

2 visualizaciones (últimos 30 días)
Vincent I
Vincent I el 15 de Jul. de 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

Respuestas (1)

Vincent I
Vincent I el 15 de Jul. de 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....

Categorías

Más información sobre Migrate GUIDE Apps en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by