MATLAB modifies the Position of a GUI created using GUIDE, when placed on the left side of the screen
11 views (last 30 days)
Show older comments
MathWorks Support Team
on 15 Dec 2017
Answered: MathWorks Support Team
on 20 Dec 2017
When I create a GUI using GUIDE and place it on the left side of the screen by setting the 'Position' property (to [1 1 560 420]), why does MATLAB force the figure to be shown at a certain default distance from the left side of the screen ([33 33 562 422])?
Accepted Answer
MathWorks Support Team
on 15 Dec 2017
When we position the GUI at the left edge of the screen (either at top or bottom), MATLAB leaves a border between the GUI and the screen edges, hence modifying the GUI's Position property value. MATLAB automatically places a 32-pixel border between the figure and the edge of the screen to prevent operating systems' toolbar's from obscuring the GUI.
In order to work around this issue and place the GUI at the bottom edge of the screen, thus avoiding the 32 pixel border, you can do the following:
1. Use GUIDE to modify the GUI's Visible property to 'off'.
2. Add the following 2 lines of MATLAB code to the GUI OutputFcn:
set(hObject,'Visible','on');
set(hObject,'Position',[1 1 <desired_width> <desired_height>]);
Use the same pattern to place the GUI at the left top edge of the screen, except that you must calculate the y-offset (the second Position value) based on screen height.
0 Comments
More Answers (0)
See Also
Categories
Find more on Printing and Saving 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!