Reputation: 74940
For portability, I set the units of my GUIs to 'characters'. Now I have a user who wants to use Matlab on his netbook, and the GUI window is larger than the screen (and thus cropped at the top).
I think I could try and write something in the openingFcn of the GUI that measures screen size and then adjusts the GUI accordingly, but I'd rather avoid that, because I then need to deal with text that is bigger than the text boxes, etc.
What I'd rather like to do is somehow adjust the unit 'character' on his Matlab installation. None of the font sizes in the preferences seem to have an effect on unit:character, though. Does anyone know whether there's a setting for that, which can be changed from within Matlab (I don't mind if it's something that is reset at every reboot, since I can just put it into the startup script)?
Upvotes: 3
Views: 2006
Reputation: 125874
Might I suggest an alternative to consider when designing your GUI:
'FontUnits'
property set to 'normalized'
.CreateFcn/OpeningFcn/ResizeFcn
functions so they will resize the GUI to fit the screen size.When the GUI and its objects are resized, the text will resize accordingly, thus helping to avoid text that ends up bigger than the text boxes. One thing to keep note of is that normalized units for the font will interpret the value of 'FontSize'
property as a fraction of the height of the uicontrol. I also make it a habit to set the 'FontName'
property to 'FixedWidth'
to help control the width of the text.
Upvotes: 5