Thread Subject: set GUI Position

Subject: set GUI Position

From: Lars Warmbold

Date: 18 Nov, 2007 20:07:38

Message: 1 of 4

I inserted the following code to my GuiOpeningFcn in order
to place the GuiFigure on the very left side of the screen
at start:

set(gcf, 'Units' , 'Normalized');
set(gcf, 'Position', [0, 0.3, 1, 0.5]);

But the Gui-MainFcn does something I don't understand!!!
There's always some space on the left hand side of the Gui
left. I figured out that Matlab forces 'undocked' figures to
appear on the screen at start: means that

set(gcf, 'Position', [-2, 0.3, 1, 0.5]);

leads to the same position as the above given: On screen but
not as far left as possible.

How can I supress the 'automatic placing service' done by
the GuiMainFcn?

Thanks in advance!!! LARS

Subject: set GUI Position

From: Bruno Luong

Date: 18 Nov, 2007 21:37:34

Message: 2 of 4

"Lars Warmbold" <mustermann.klaus.TO.REMOVE@gmx.de> wrote in
message <fhq62a$4tb$1@fred.mathworks.com>...

It seems that after calling OpeningFcn,
gui_mainfcn calls
openfig calls
movegui(fig, 'onscreen'), which add a margin of 30 pixels.

If you are willing to mess around with MATLAB source, you
could edit the file movegui.m (on $MATLAB/toolbox/uitools/
), and change the variable margin to 0 (or -1).

Bruno

Subject: set GUI Position

From: Lars Warmbold

Date: 19 Nov, 2007 10:41:24

Message: 3 of 4

"Bruno Luong" <brunoluong@yahoo.com> wrote in message
<fhqbau$bej$1@fred.mathworks.com>...
> "Lars Warmbold" <mustermann.klaus.TO.REMOVE@gmx.de> wrote in
> message <fhq62a$4tb$1@fred.mathworks.com>...
>
> It seems that after calling OpeningFcn,
> gui_mainfcn calls
> openfig calls
> movegui(fig, 'onscreen'), which add a margin of 30 pixels.
>
> If you are willing to mess around with MATLAB source, you
> could edit the file movegui.m (on $MATLAB/toolbox/uitools/
> ), and change the variable margin to 0 (or -1).
>
> Bruno

Thank You Bruno! That's what I found out too. I thought
there could be a softer way like

set(fig, 'Onscreen', 'Off');

just to be included in OpeningFcn...

Hmm. Finally I put this position setting into the OutputFcn,
which is called after the Gui is placed automatcally. Thanks
anyway!!!

LARS

Subject: set GUI Position

From: Francis

Date: 20 Jan, 2012 18:00:11

Message: 4 of 4

"Lars" wrote in message <fhrp8k$7eo$1@fred.mathworks.com>...
> Thank You Bruno! That's what I found out too. I thought
> there could be a softer way like
>
> set(fig, 'Onscreen', 'Off');
>
> just to be included in OpeningFcn...
>
> Hmm. Finally I put this position setting into the OutputFcn,
> which is called after the Gui is placed automatcally. Thanks
> anyway!!!

I have the same problem you described - an annoying gap between the GUI window and the edge of the screen which no amount of repositioning seems to eliminate. I wanted to try your solution about but in my version of MATLAB (2009b) there is no 'Onscreen' property. Was this removed?? And if so, is there another way to have the GUI window positioned hard against the edge of the screen? (I am not willing to alter MATLAB function code.)
Cheers,
Francis

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

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.

rssFeed for this Thread

Contact us at files@mathworks.com