Skip to Main Content Skip to Search
Login
File Exchange
MATLAB Newsgroup
Link Exchange
  Blogs  
 Contest 
MathWorks.com

Thread Subject: set GUI Position

Subject: set GUI Position

From: Lars Warmbold

Date: 18 Nov, 2007 20:07:38

Message: 1 of 3

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 3

"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 3

"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


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

envelope graphic E-mail this page to a colleague

Public Submission Policy
NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.
Related Topics