Single-Select uitable Cells

3 views (last 30 days)
Thomas Sawyer
Thomas Sawyer on 11 May 2020
I have a simple GUI that displays a whole bunch of characters (the result of cellstr(char((0:10000)'))). The idea is that when I want to print a special character I want to launch this tool and select the character I want and have it display it's code at the bottom. I then want to make use of that code to convert to a char so I can print it.
The problem I'm running into is that I'm using uitable and I cannot find a way to enforce single-selection for the table. I wrote a fancy algorithm, for the CellSelectionCallback that in theory should work but it is problematic. I think my problem comes from the fact that the callback gets called many times with a different set of selected cells as the input each time. The only case I have attempted to handle is the case where the user clicks on one cell and drags across a group of them. I want only the last one they selected to be left selected. I have not attempted to handle the case where the user holds Ctrl and then starts selecting cells.
If there is a builtin way of enforcing a single selection that would great. I have even tried retrieving the jTable object and setting the selectionMode by jtable.setSelectionMode(0). The place I found that solution says that it works as of 2017a, but I'm using 2017b and it doesn't work. :(

Answers (0)

Categories

Find more on MATLAB in Help Center and File Exchange

Products


Release

R2017b

Community Treasure Hunt

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

Start Hunting!