Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Positioning a GUI

Subject: Positioning a GUI

From: Thorarin Bjarnason

Date: 4 Jul, 2008 16:30:06

Message: 1 of 5

Hello:

I have a gui created using guide. I would like this gui to
launch in the upper left corner of the screen.

I tried using 'movegui', but I can only get it to work after
the gui has become viewable <ie it does not work within the
GUI_OpeningFunction(...) area>, causing it to jump to the
new location.

Suggestions?

Subject: Positioning a GUI

From: Aleks

Date: 4 Jul, 2008 23:21:02

Message: 2 of 5

"Thorarin Bjarnason" <thor4ooo@gmail.com> wrote in message
<g4lj6e$b6a$1@fred.mathworks.com>...
> Hello:
>
> I have a gui created using guide. I would like this gui to
> launch in the upper left corner of the screen.
>
> I tried using 'movegui', but I can only get it to work after
> the gui has become viewable <ie it does not work within the
> GUI_OpeningFunction(...) area>, causing it to jump to the
> new location.
>
> Suggestions?
It's a UI Panel property called "Position". It looks like this:
"rect = [left, bottom, width, height]
where left and bottom define the distance from the lower
left corner of the screen to the lower left corner of the
figure window. width and height define the dimensions of the
window. See the Units property for information on the units
used in this specification. The left and bottom elements can
be negative on systems that have more than one monitor." <--
I copied and pasted this for you.

You can get real fancy by normalizing all your figures
depending on the size of the monitor user has :). Search
help files for the "The Position Vector"

Aleks

Subject: Positioning a GUI

From: Vihang Patil

Date: 5 Jul, 2008 08:30:04

Message: 3 of 5

"Thorarin Bjarnason" <thor4ooo@gmail.com> wrote in message
<g4lj6e$b6a$1@fred.mathworks.com>...
> Hello:
>
> I have a gui created using guide. I would like this gui
to
> launch in the upper left corner of the screen.
>
> I tried using 'movegui', but I can only get it to work
after
> the gui has become viewable <ie it does not work within
the
> GUI_OpeningFunction(...) area>, causing it to jump to the
> new location.
>
> Suggestions?
 Lauch your main gui (say main_gui)through other m
function say calling_fcn and do the following
example:

function calling_fcn
h = main_gui;
movegui(h,'northwest');


HTH
Vihang

Subject: Positioning a GUI

From: matt dash

Date: 5 Jul, 2008 15:26:01

Message: 4 of 5

"Vihang Patil" <vihang_patil@yahoo.com> wrote in message
<g4nbec$oi7$1@fred.mathworks.com>...
> "Thorarin Bjarnason" <thor4ooo@gmail.com> wrote in message
> <g4lj6e$b6a$1@fred.mathworks.com>...
> > Hello:
> >
> > I have a gui created using guide. I would like this gui
> to
> > launch in the upper left corner of the screen.
> >
> > I tried using 'movegui', but I can only get it to work
> after
> > the gui has become viewable <ie it does not work within
> the
> > GUI_OpeningFunction(...) area>, causing it to jump to the
> > new location.
> >
> > Suggestions?
> Lauch your main gui (say main_gui)through other m
> function say calling_fcn and do the following
> example:
>
> function calling_fcn
> h = main_gui;
> movegui(h,'northwest');
>
>
> HTH
> Vihang
>
>
>

This is a very commmon question. See last post here for
example:
http://www.mathworks.com/matlabcentral/newsreader/view_thread/161654#408756

If GUIDE finds your gui is too close to the edge, it will
reposition it UNLESS you have defined a layout function. The
layout function just needs to open the fig file, then you
can reposition the figure anywhere you want. (Either in the
openingfcn, the layoutfcn, or saved in the figure itself.)

Subject: Positioning a GUI

From: Thorarin Bjarnason

Date: 16 Jul, 2008 18:58:02

Message: 5 of 5

Aleks:

Thanks. That was exactly what I was looking for.

Have a nice day,

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us