Uitable gui different size on different computers
2 views (last 30 days)
Show older comments
James Boyle
on 16 May 2017
Commented: James Boyle
on 17 May 2017
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 Comments
Accepted Answer
Cam Salzberger
on 16 May 2017
Edited: Cam Salzberger
on 16 May 2017
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
More Answers (0)
See Also
Categories
Find more on Migrate GUIDE Apps in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!