Implementing multiple selection and selection range for UITable in App Designer

조회 수: 14 (최근 30일)
Fatai Anifowose
Fatai Anifowose 2020년 3월 23일
댓글: JClarcq 2020년 5월 11일
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.

답변 (1개)

Mohammad Sami
Mohammad Sami 2020년 4월 24일
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
Mohammad Sami
Mohammad Sami 2020년 4월 24일
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 2020년 5월 11일
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

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by