Thread Subject: How to suppress figure() to bring figure to foreground?

Subject: How to suppress figure() to bring figure to foreground?

From: Joe Duchtel

Date: 16 Sep, 2009 14:12:11

Message: 1 of 8

Hello -

I realize that I need to use the figure() command to create a figure
but is there any way that it will not automatically bring each figure
to the forground if it is called for a figure that is already open?
This happens since I run an m-file several times without closing each
figure prior to a new run.

Is there a way to get a list of all open figures? I tried get(0) but
the 'CurrentFigure' will only tell the currently active figure.

Thanks,
Joe

Subject: How to suppress figure() to bring figure to foreground?

From: nor ki

Date: 16 Sep, 2009 14:57:19

Message: 2 of 8

Joe Duchtel <duchtel@gmail.com> wrote in message <cd62214e-2635-4f6d-a367-eb8fbfaef57b@o36g2000vbl.googlegroups.com>...
> Hello -
>
> I realize that I need to use the figure() command to create a figure
> but is there any way that it will not automatically bring each figure
> to the forground if it is called for a figure that is already open?
> This happens since I run an m-file several times without closing each
> figure prior to a new run.
>
> Is there a way to get a list of all open figures? I tried get(0) but
> the 'CurrentFigure' will only tell the currently active figure.
>
> Thanks,
> Joe


HI Joe,

h = figure('visible', 'off')

get(0,'children')

hth kinor

Subject: How to suppress figure() to bring figure to foreground?

From: Donn Shull

Date: 16 Sep, 2009 14:59:05

Message: 3 of 8

Joe Duchtel <duchtel@gmail.com> wrote in message <cd62214e-2635-4f6d-a367-eb8fbfaef57b@o36g2000vbl.googlegroups.com>...
> Hello -
>
> I realize that I need to use the figure() command to create a figure
> but is there any way that it will not automatically bring each figure
> to the forground if it is called for a figure that is already open?
> This happens since I run an m-file several times without closing each
> figure prior to a new run.
>
> Is there a way to get a list of all open figures? I tried get(0) but
> the 'CurrentFigure' will only tell the currently active figure.
>
> Thanks,
> Joe

Hello Joe,

You can use get(0, 'Children') to return all the children of the desktop.

Hope this helps,

Donn

Subject: How to suppress figure() to bring figure to foreground?

From: Joe Duchtel

Date: 16 Sep, 2009 16:12:18

Message: 4 of 8

On Sep 16, 10:59 am, "Donn Shull" <donn.shull.no_s...@aetoolbox.com>
wrote:
> Joe Duchtel <duch...@gmail.com> wrote in message <cd62214e-2635-4f6d-a367-eb8fbfaef...@o36g2000vbl.googlegroups.com>...
> > Hello -
>
> > I realize that I need to use the figure() command to create a figure
> > but is there any way that it will not automatically bring each figure
> > to the forground if it is called for a figure that is already open?
> > This happens since I run an m-file several times without closing each
> > figure prior to a new run.
>
> > Is there a way to get a list of all open figures?  I tried get(0) but
> > the 'CurrentFigure' will only tell the currently active figure.
>
> > Thanks,
> > Joe
>
> Hello Joe,
>
> You can use get(0, 'Children') to return all the children of the desktop.
>
> Hope this helps,
>
> Donn

Hello -

Thanks for the information. I determined the handles of my figures
using the get(0, 'Children') but when I do a figure(hFigure) to make a
certain figure my active figure, it is still moved to the foreground.
The 'Visible' will just hide the figure and turning that back 'on'
also moves it to the foreground.

Thanks,
Joe

Subject: How to suppress figure() to bring figure to foreground?

From: Rune Allnor

Date: 16 Sep, 2009 16:44:50

Message: 5 of 8

On 16 Sep, 18:12, Joe Duchtel <duch...@gmail.com> wrote:
> On Sep 16, 10:59 am, "Donn Shull" <donn.shull.no_s...@aetoolbox.com>
> wrote:
>
>
>
>
>
> > Joe Duchtel <duch...@gmail.com> wrote in message <cd62214e-2635-4f6d-a367-eb8fbfaef...@o36g2000vbl.googlegroups.com>...
> > > Hello -
>
> > > I realize that I need to use the figure() command to create a figure
> > > but is there any way that it will not automatically bring each figure
> > > to the forground if it is called for a figure that is already open?
> > > This happens since I run an m-file several times without closing each
> > > figure prior to a new run.
>
> > > Is there a way to get a list of all open figures?  I tried get(0) but
> > > the 'CurrentFigure' will only tell the currently active figure.
>
> > > Thanks,
> > > Joe
>
> > Hello Joe,
>
> > You can use get(0, 'Children') to return all the children of the desktop.
>
> > Hope this helps,
>
> > Donn
>
> Hello -
>
> Thanks for the information.  I determined the handles of my figures
> using the get(0, 'Children') but when I do a figure(hFigure) to make a
> certain figure my active figure, it is still moved to the foreground.
> The 'Visible' will just hide the figure and turning that back 'on'
> also moves it to the foreground.

Seems you have hit some OS-specific issues. I remember some
UNIX flavours where you could specify parameters like
PointerFocusPolicy (*), which specified if you had to click
on a window to activate it, or just bring the mouse cursor
on top of it. There was similar parameters like
BringToForegroundPolicy (*), to specifiy whether the activated
wondow shouls pop to the front or remain partially hidden
when activated.

The problem was/is that MSWindows didn't/don't have similar
parameters: If a window is activated and visible, it pops to
the foreground, and there is nothing one can do to prevent it.

Don't expect too much from an OS that can trace its roots
to the infamous Quick'n Dirty DOS...

Rune

(*) probably not correct names.

Subject: How to suppress figure() to bring figure to foreground?

From: Stephan

Date: 16 Sep, 2009 17:22:02

Message: 6 of 8

Joe Duchtel <duchtel@gmail.com> wrote in message <cd62214e-2635-4f6d-a367-eb8fbfaef57b@o36g2000vbl.googlegroups.com>...
> Hello -
>
> I realize that I need to use the figure() command to create a figure
> but is there any way that it will not automatically bring each figure
> to the forground if it is called for a figure that is already open?
> This happens since I run an m-file several times without closing each
> figure prior to a new run.
>
> Is there a way to get a list of all open figures? I tried get(0) but
> the 'CurrentFigure' will only tell the currently active figure.
>
> Thanks,
> Joe

I'm not sure what you wanna do, but you can usually indicate the object in which you want to plot. If you want to plot in the (only) axis of a figure with handle fig, you could write

plot(get(fig,'Children'), 1:1000)

In this way the data is plotted in the correct axis without the figure being moved to the top of the screen. I usually "remember" the handles to axis and figures if i want to draw into them multiple times, e.g.

fig1 = figure;
ax1 = axes;

etc.

Hope that helps. If not, maybe post some of your code.

Stephan

Subject: How to suppress figure() to bring figure to foreground?

From: Steven Lord

Date: 16 Sep, 2009 17:26:41

Message: 7 of 8


"Joe Duchtel" <duchtel@gmail.com> wrote in message
news:8c9db9f2-45cd-46e2-9fd3-8f6ff4aaf027@p23g2000vbl.googlegroups.com...

*snip*

> Thanks for the information. I determined the handles of my figures
> using the get(0, 'Children') but when I do a figure(hFigure) to make a
> certain figure my active figure, it is still moved to the foreground.
> The 'Visible' will just hide the figure and turning that back 'on'
> also moves it to the foreground.

Yes, this is expected and documented behavior, as described in the fourth
paragraph of the Description section of the FIGURE reference page:

http://www.mathworks.com/access/helpdesk/help/techdoc/ref/figure.html

The "Making a Figure Current" section of that documentation describes how to
make a figure current without changing its stacking order.

--
Steve Lord
slord@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ

Subject: How to suppress figure() to bring figure to foreground?

From: Joe Duchtel

Date: 16 Sep, 2009 19:39:18

Message: 8 of 8

On Sep 16, 1:26 pm, "Steven Lord" <sl...@mathworks.com> wrote:
> "Joe Duchtel" <duch...@gmail.com> wrote in message
>
> news:8c9db9f2-45cd-46e2-9fd3-8f6ff4aaf027@p23g2000vbl.googlegroups.com...
>
> *snip*
>
> > Thanks for the information.  I determined the handles of my figures
> > using the get(0, 'Children') but when I do a figure(hFigure) to make a
> > certain figure my active figure, it is still moved to the foreground.
> > The 'Visible' will just hide the figure and turning that back 'on'
> > also moves it to the foreground.
>
> Yes, this is expected and documented behavior, as described in the fourth
> paragraph of the Description section of the FIGURE reference page:
>
> http://www.mathworks.com/access/helpdesk/help/techdoc/ref/figure.html
>
> The "Making a Figure Current" section of that documentation describes how to
> make a figure current without changing its stacking order.
>
> --
> Steve Lord
> sl...@mathworks.com
> comp.soft-sys.matlab (CSSM) FAQ:http://matlabwiki.mathworks.com/MATLAB_FAQ

Hello -

Great ... the set(0, 'CurrentFigure', hFigure) works perfectly!

Thanks a lot to everybody!
Joe

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
 

MATLAB Central Terms of Use

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 Terms prior to use.

Contact us at files@mathworks.com