Is it possible to have different type of elementes on different rows on a uitable?

3 次查看(过去 30 天)
I have an uitable and I need to have different types of elemnts on the rows that belong to the same column, how can I do this? Matlab only allows me to have ONE element type for the whole column. Also, is it possible to let the user modify some rows and some others no? Currently I am able to set this 'editable' option only for the columns, no for each specific row. Thanks!

回答(1 个)

Walter Roberson
Walter Roberson 2015-12-14
In order to do those things you would need to go in at the Java level; MATLAB does not offer that level of control.
The most common way to handle mixed formats in a single column is to convert the column to string while it is in the uitable(), and converting the strings to appropriate numeric form if needed for computation.
A potential work around to prevent editing some rows would be to use a CellSelectionCallback, and if you detected that a logically read-only row was selected then to change the selection (even if it requires making the active object something else.) You cannot write into something you effectively cannot select.

类别

Help CenterFile Exchange 中查找有关 Programming 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by