MATLAB Answers

0

How do you enable a GUI to adjust to fit screens of varying resolution

Asked by Cordelle on 1 Jul 2013
Latest activity Edited by Walter Roberson
on 1 Jan 2017
I created a GUI in Guide and I want my GUI to adjust to fit screens of different varying resolution, because my application will be used on different computers.
Is there a way to allow this guide? If so, how?
or
Is there a few lines of code need to enable this feature? If so, where can i find examples of the code?
Thank you in advance,
Cordelle

  0 Comments

Sign in to comment.

2 Answers

Answer by Tom
on 1 Jul 2013
 Accepted Answer

In GUIDE, under Tools -> GUI options you can specify the resizing of the figure, including your own resize function.
You might also want to consider this FEX Submission.

  6 Comments

try running it in the command line - it will give you the screen size in pixels. Yes, or you can change them when the GUI loads, for example in the OpeingFcn:
set(findobj(handles.figure1),'Units','Normalized')
Once im given the screen size, how can i use the info to allow my GUI to adjust to any screen itself?
You can set the figure size to the screensize:
set(handles.figure1,'Units','Pixels','Position',get(0,'ScreenSize'))
And from there resize the objects of the GUI.

Sign in to comment.


Answer by Panu Pratumnopharat on 1 Jan 2017
Edited by Walter Roberson
on 1 Jan 2017

GUI = figure('Color',[0.941 0.941 0.941],...
'Name','HAWTsimulator',...
'NumberTitle','off',...
'MenuBar','none',...
'Unit','normalized',...
'Position',[0 0 1 1],...
'outerposition',[0 0 1 1]);

  0 Comments

Sign in to comment.