Fit height uitable App Designer

37 ビュー (過去 30 日間)
Riccardo Barilli
Riccardo Barilli 2020 年 11 月 27 日
コメント済み: J. Alex Lee 2021 年 2 月 20 日
When I create a table in app designer (evenif inside a layout), there will be a white area under the table if my rows are not enough (see first screenshot).
On the other hand, fairly, more rows will result in a scroll bar.
But I would like to obtain, in case of a few rows, a result like the one in the second screenshot.
Is it possible to achieve this result?
Thank you

採用された回答

J. Alex Lee
J. Alex Lee 2020 年 11 月 30 日
it wouldn't work with the "fit" gridlayout, but if it is really important to you, what i have done in the past is to measure the number of pixels associated with each row and multiply that by the number of rows currently in the table, plus 1 pixel for each row plus 2 (for the borders), and the height of the header row if you have one.
you can set the height (Position(2)) of the uitable any time the number of rows of data changes or on resize (I haven't tried with the resize).
  2 件のコメント
Diaa
Diaa 2021 年 2 月 18 日
How can I know or measure each row height in pixels?
J. Alex Lee
J. Alex Lee 2021 年 2 月 20 日
When I did this in the past, I did trial-and-error. The font size you use is a good starting point. Or just screenshot and count pixels.

サインインしてコメントする。

その他の回答 (1 件)

J. Alex Lee
J. Alex Lee 2020 年 11 月 27 日
Look into uigridlayout with the "fit" keyword for row heights
  2 件のコメント
Riccardo Barilli
Riccardo Barilli 2020 年 11 月 29 日
Hi Alex,
a quote from the online guide: For non text-based components, 'fit' height is based on the default size of the component and other factors
I tried that way but the grid fitted the table object. At the end, I obtain the same effect of my first screenshot. I think the problem is that the table is not able to adapt itself to its content.
J. Alex Lee
J. Alex Lee 2020 年 11 月 30 日
oh that's too bad...i admit i hadn't used uitable much in newer versions...I just tested on my matlab and find the same thing. well, that's frustrating...i'll post another answer, though it is cumbersome.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeMigrate GUIDE Apps についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by