Uitable gui different size on different computers
2 次查看(过去 30 天)
显示 更早的评论
I have a table of data in my gui that displays fine and where I want it to be. However when run on a different machine, the table itself is in the same place, but the data does not fill the table and there is a white edge around it.
Here is the code for the table and an image of what I mean with the white edge.
The problem appears to be the width of the first column. It is of a different size on separate computers. Any idea how I can set this to be the same? There does not appear to be a variable I can change for it? Thanks.
tonetable = uitable(main_window, 'data', finaldata);
tonetable.ColumnName = {'Value'} ;
tonetable.BackgroundColor = [.4 .4 .4; 1 0.5 0];
tonetable.ForegroundColor = [1 1 1];
tonetable.RowName = {'-----'};
tonetable.Position = [875 85 350 330];
tonetable.ColumnWidth = {128};
tonetable.FontSize = 10;
0 个评论
采纳的回答
Cam Salzberger
2017-5-16
编辑:Cam Salzberger
2017-5-16
Hello James,
Different systems, especially if they have different operating systems, will frequently cause UI components to appear in different sizes. Using 'Position' units of all 'character' can help to make sure any changes scale with the system, and still fit the text contents of the component.
However, for this particular issue, I think there's a much simpler workaround. If you just specify the 'ColumnWidth' property to 'auto', rather than providing an exact value, I believe that they will fill the table, and should fit the text if it is possible to do so. You could even specify the width of one of the columns exactly, and let the other one be 'auto' so that it can grow or shrink to fill the table as necessary. See the examples in the documentation page for both methods.
-Cam
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Migrate GUIDE Apps 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!