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

3 ビュー (過去 30 日間)
Mariale
Mariale 2015 年 12 月 14 日
回答済み: Walter Roberson 2015 年 12 月 14 日
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 Center および File ExchangeProgramming についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by