Getting Cell location of checkboxes on selection (UITable)

5 visualizaciones (últimos 30 días)
Jason
Jason el 13 de Mzo. de 2020
Comentada: J. Alex Lee el 15 de Mzo. de 2020
Hello, I have a UITable that contains checkboxes (logical data type). I want o be able to select cells and create a list (in a listbox) of those selected cells (this will then be passed to a motorised stage to scan those positions on a sample).
I am able to highlight selected cells and add these to a list box when I select the cell, but not when the checkboxes are selected.
How do I get the location of each of the selected checkboxes?
This is my code.
% Cell selection callback: UITable
function UITableCellSelection(app, event)
indicies = event.Indices
col=indicies(1); row=indicies(2);
s1 = uistyle('BackgroundColor','red');
s2 = uistyle('BackgroundColor','green'); %Not using this yet!
addStyle(app.UITable,s1,'cell',[col row]); %New feature!
%Add to list box
selectedString = strcat('column=',num2str(row),' row=',num2str(col)); % Needs to be a string
listBoxData = app.ListBox.Items %Get current values
if isempty(listBoxData) || ~any(strcmpi(listBoxData, selectedString))
listBoxData = [listBoxData, selectedString];
app.ListBox.Items=listBoxData;
end
end

Respuesta aceptada

J. Alex Lee
J. Alex Lee el 13 de Mzo. de 2020
Is it as simple as defining a CellEditCallback?

Más respuestas (0)

Categorías

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

Productos


Versión

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by