Single Selection in Uitable

Hi,
Is there a way to force Single Row Selection in a uitable (new version with appdesigner) ?
I use a table to show properties (in columns) of a list of objects (in rows). I want that the user selects one (and only one) object and uses some push buttons to edit / suppress / compute the object (As edit or compute callbacks open a dialog box, i don't want that several dialog boxes open if the user selected serveral objects).
Stéphanie.

Antworten (1)

Mario Malic
Mario Malic am 4 Feb. 2021

0 Stimmen

Hi,
you can't force it, but you can validate the selection.
Event.Indices returns n by 2 array (row, column). If all elements in the first column are equal then the selection is valid and you can continue with the computation. Otherwise, issue a warning with uialert.

5 Kommentare

Stéphanie
Stéphanie am 4 Feb. 2021
Thanks for your proposal.
As i can't force the single selection programmaticaly, i use only the first row of Event.Indices.
I'm quite disappointed because 'selectedRows' is a common feature for table component in lot of language (Qt, ...). I hope that Mathworks will add this feature soon.
Stéphanie
You can use this to get all selected rows in the table.
indices =
1 2
1 3
2 2
2 3
5 2
5 3
selectedRows = unique(indices(:,1))
selectedRows =
1
2
5
Stéphanie
Stéphanie am 4 Feb. 2021
I was thinking about SelectedRows as a property of the table component that can be get or set.
Mario Malic
Mario Malic am 4 Feb. 2021
Would be nice, yes.
Voss
Voss am 26 Dez. 2021
Yes MATLAB uitables are really essentially useless pieces of garbage, unfortunately, for all but the most rudimentary applications.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Develop Apps Using App Designer finden Sie in Hilfe-Center und File Exchange

Produkte

Version

R2020b

Gefragt:

am 4 Feb. 2021

Kommentiert:

am 26 Dez. 2021

Community Treasure Hunt

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

Start Hunting!

Translated by