From: Perry <reply@board.com>
Path: news.mathworks.com!newsfeed-00.mathworks.com!webcrossing
Newsgroups: comp.soft-sys.matlab
Subject: Re: Interrupt for Current Figure Change
Message-ID: <ef3860a.0@webcrossing.raydaftYaTP>
Date: Thu, 1 Jun 2006 11:25:44 -0400
References: <ef3860a.-1@webcrossing.raydaftYaTP>
Lines: 37
NNTP-Posting-Host: 172.214.143.19
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
Xref: news.mathworks.com comp.soft-sys.matlab:352889



Ian,

I think what you need here is an 'OnFocus' function, i.e. a function
that is called only when the user selcts it, i.e. the figures becomes
'the focus'. The bad part is, I'm not sure Matlab enables you to
specify one. Sure you can 'get the current figure' with gcf, but you
still need to initiate this command when the figure becomes the
focus.

The nearest thing I can find to achieve this is to specify a
WindowButtonDownFcn callback. In this function you could set some
applicationdata that could be read by your control figure as to which
figure was last active.

NOTE : This function is called when the user presses the mouse button
in the figure. It does NOT get called if the user selects the title
bar or and axis within the figure, so it's not going to work 100% of
the time. As I say, Matlab (I don't think) provides an 'OnFocus'
callback option.

Perry

Ian Woloschin wrote:
>
>
> Is it possible to detect when the current figure has changed
> through
> an interrupt/callback?
>
> I have a gui control figure that enables features (such as panning)
> in other figures, but for simplicity, only one figure is active at
> any given time. At this point, you need to go to the control
> figure
> to specify the active figure, but I'd like for the control gui to
> automatically update if the current figure switches from, say,
> figure
> 1 to figure 2.