Implementing multiple selection and selection range for UITable in App Designer

23 visualizzazioni (ultimi 30 giorni)
Following the notice that GUIDE will be removed from MATLAB by the end of 2020, I started developing my new projects using App Designer. To put it mildly, it's been a tough journey so far. A number of capabilities in GUIDE are not working in App Designer.
I am facing some challenges specifically on getting the UITable to work for me. The following are my specific issues:
  1. Multiple cell selection using "CTRL+ mouse click" used to be by default in GUIDE. How can I do same in App Designer? I need to programatically get the index of the selected cells.
  2. Range selection using mouse drag used to be by default in GUIDE. How can I do same in App Designer? I also need to get the index of the selected cell ranges.
These are my issues for now.
Thanks.

Risposte (1)

Mohammad Sami
Mohammad Sami il 24 Apr 2020
I have no answer for your first question.
For the second question, I was able to do range selection using left click and dragging the mouse in R2020a.
% quick test
b = randi([1 10],10,10);
b = array2table(b);
f = uifigure;
t = uitable(f);
t.Data = b;
t.CellSelectionCallback = @(~,event)disp(event);
% the event object has the following properties
%CellSelectionChangeData with properties:
% Indices: [8×2 double] first column is row number, second column in column number
% DisplayIndices: [8×2 double]
% Source: [1×1 Table]
% EventName: 'CellSelection'
  2 Commenti
Mohammad Sami
Mohammad Sami il 24 Apr 2020
For more information on the supported selection options, please see the documentation of CellSelectionCallback for your version of matlab.
Further to my answer, it list all the currently available options for Contiguous Selection Options and Discontiguous Selection Options.
https://www.mathworks.com/help/releases/R2020a/matlab/ref/matlab.ui.control.tableappd-properties.html
https://www.mathworks.com/help/releases/R2019b/matlab/ref/matlab.ui.control.tableappd-properties.html
JClarcq
JClarcq il 11 Mag 2020
Current method of selecting discontinuous cell is totally non-obvious to most users.
"Then, Ctrl+click to focus another cell, and finally Shift+click to select the cell that is in focus"
Even if I know this behavior, this is really unnatural to me. Users are mostly expecting an Excel like behavior which would be:
click to focus cell, Ctrl+click to select, ctrl+shift+click, to select discontinuous groups of continous cells

Accedi per commentare.

Categorie

Scopri di più su Migrate GUIDE Apps in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by