<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/125759</link>
    <title>MATLAB Central Newsreader - Interrupt for Current Figure Change</title>
    <description>Feed for thread: Interrupt for Current Figure Change</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Thu, 01 Jun 2006 09:36:41 -0400</pubDate>
      <title>Interrupt for Current Figure Change</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/125759#316702</link>
      <author>Ian Woloschin</author>
      <description>Is it possible to detect when the current figure has changed through&lt;br&gt;
an interrupt/callback?&lt;br&gt;
&lt;br&gt;
I have a gui control figure that enables features (such as panning)&lt;br&gt;
in other figures, but for simplicity, only one figure is active at&lt;br&gt;
any given time. At this point, you need to go to the control figure&lt;br&gt;
to specify the active figure, but I'd like for the control gui to&lt;br&gt;
automatically update if the current figure switches from, say, figure&lt;br&gt;
1 to figure 2.</description>
    </item>
    <item>
      <pubDate>Thu, 01 Jun 2006 11:25:44 -0400</pubDate>
      <title>Re: Interrupt for Current Figure Change</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/125759#316726</link>
      <author>Perry</author>
      <description>Ian,&lt;br&gt;
&lt;br&gt;
I think what you need here is an 'OnFocus' function, i.e. a function&lt;br&gt;
that is called only when the user selcts it, i.e. the figures becomes&lt;br&gt;
'the focus'. The bad part is, I'm not sure Matlab enables you to&lt;br&gt;
specify one. Sure you can 'get the current figure' with gcf, but you&lt;br&gt;
still need to initiate this command when the figure becomes the&lt;br&gt;
focus.&lt;br&gt;
&lt;br&gt;
The nearest thing I can find to achieve this is to specify a&lt;br&gt;
WindowButtonDownFcn callback. In this function you could set some&lt;br&gt;
applicationdata that could be read by your control figure as to which&lt;br&gt;
figure was last active.&lt;br&gt;
&lt;br&gt;
NOTE : This function is called when the user presses the mouse button&lt;br&gt;
in the figure. It does NOT get called if the user selects the title&lt;br&gt;
bar or and axis within the figure, so it's not going to work 100% of&lt;br&gt;
the time. As I say, Matlab (I don't think) provides an 'OnFocus'&lt;br&gt;
callback option.&lt;br&gt;
&lt;br&gt;
Perry&lt;br&gt;
&lt;br&gt;
Ian Woloschin wrote:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Is it possible to detect when the current figure has changed&lt;br&gt;
&amp;gt; through&lt;br&gt;
&amp;gt; an interrupt/callback?&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; I have a gui control figure that enables features (such as panning)&lt;br&gt;
&amp;gt; in other figures, but for simplicity, only one figure is active at&lt;br&gt;
&amp;gt; any given time. At this point, you need to go to the control&lt;br&gt;
&amp;gt; figure&lt;br&gt;
&amp;gt; to specify the active figure, but I'd like for the control gui to&lt;br&gt;
&amp;gt; automatically update if the current figure switches from, say,&lt;br&gt;
&amp;gt; figure&lt;br&gt;
&amp;gt; 1 to figure 2.</description>
    </item>
    <item>
      <pubDate>Thu, 01 Jun 2006 12:43:10 -0400</pubDate>
      <title>Re: Interrupt for Current Figure Change</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/125759#316745</link>
      <author>Ian Woloschin</author>
      <description>I've considered trying to use the WindowButtonDownFcn, but I haven't&lt;br&gt;
done any serious work on that yet. I'm actually using the&lt;br&gt;
WindowButtonDownFcn already, but if I compare the figure that's&lt;br&gt;
active to the one I think should be active, that would let me know if&lt;br&gt;
the user made a new figure the current figure.&lt;br&gt;
&lt;br&gt;
However, this does not take into account if they alt-tabbed into the&lt;br&gt;
figure or clicked the title bar, etc, as you said. For my purposes,&lt;br&gt;
the above may be enough as my program requires you to click on the&lt;br&gt;
axes eventually to do anything, but it's a rather silly way to go&lt;br&gt;
about writing a program.&lt;br&gt;
&lt;br&gt;
&amp;nbsp;Perry wrote:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Ian,&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; I think what you need here is an 'OnFocus' function, i.e. a&lt;br&gt;
&amp;gt; function&lt;br&gt;
&amp;gt; that is called only when the user selcts it, i.e. the figures&lt;br&gt;
&amp;gt; becomes&lt;br&gt;
&amp;gt; 'the focus'. The bad part is, I'm not sure Matlab enables you to&lt;br&gt;
&amp;gt; specify one. Sure you can 'get the current figure' with gcf, but&lt;br&gt;
&amp;gt; you&lt;br&gt;
&amp;gt; still need to initiate this command when the figure becomes the&lt;br&gt;
&amp;gt; focus.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; The nearest thing I can find to achieve this is to specify a&lt;br&gt;
&amp;gt; WindowButtonDownFcn callback. In this function you could set some&lt;br&gt;
&amp;gt; applicationdata that could be read by your control figure as to&lt;br&gt;
&amp;gt; which&lt;br&gt;
&amp;gt; figure was last active.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; NOTE : This function is called when the user presses the mouse&lt;br&gt;
&amp;gt; button&lt;br&gt;
&amp;gt; in the figure. It does NOT get called if the user selects the title&lt;br&gt;
&amp;gt; bar or and axis within the figure, so it's not going to work 100%&lt;br&gt;
&amp;gt; of&lt;br&gt;
&amp;gt; the time. As I say, Matlab (I don't think) provides an 'OnFocus'&lt;br&gt;
&amp;gt; callback option.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Perry&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Ian Woloschin wrote:&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; Is it possible to detect when the current figure has changed&lt;br&gt;
&amp;gt;&amp;gt; through&lt;br&gt;
&amp;gt;&amp;gt; an interrupt/callback?&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; I have a gui control figure that enables features (such as&lt;br&gt;
&amp;gt; panning)&lt;br&gt;
&amp;gt;&amp;gt; in other figures, but for simplicity, only one figure is active&lt;br&gt;
&amp;gt; at&lt;br&gt;
&amp;gt;&amp;gt; any given time. At this point, you need to go to the control&lt;br&gt;
&amp;gt;&amp;gt; figure&lt;br&gt;
&amp;gt;&amp;gt; to specify the active figure, but I'd like for the control gui&lt;br&gt;
to&lt;br&gt;
&amp;gt;&amp;gt; automatically update if the current figure switches from, say,&lt;br&gt;
&amp;gt;&amp;gt; figure&lt;br&gt;
&amp;gt;&amp;gt; 1 to figure 2.</description>
    </item>
    <item>
      <pubDate>Thu, 01 Jun 2006 14:27:10 -0400</pubDate>
      <title>Re: Interrupt for Current Figure Change</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/125759#316770</link>
      <author>Perry</author>
      <description>Ian,&lt;br&gt;
&lt;br&gt;
I agree it probably isn't a good way to go, but I put a post up&lt;br&gt;
myself asking if anyone knows of an 'OnFocus' callback, but no&lt;br&gt;
replies as yet. I'm curious myself now as it would be a handy&lt;br&gt;
function to have access to. I'm Just using a student version, R14 so&lt;br&gt;
maybe later versions of Matlab have this facility.&lt;br&gt;
&lt;br&gt;
Perry&lt;br&gt;
&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; I've considered trying to use the WindowButtonDownFcn, but I&lt;br&gt;
&amp;gt; haven't&lt;br&gt;
&amp;gt; done any serious work on that yet. I'm actually using the&lt;br&gt;
&amp;gt; WindowButtonDownFcn already, but if I compare the figure that's&lt;br&gt;
&amp;gt; active to the one I think should be active, that would let me know&lt;br&gt;
&amp;gt; if&lt;br&gt;
&amp;gt; the user made a new figure the current figure.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; However, this does not take into account if they alt-tabbed into&lt;br&gt;
&amp;gt; the&lt;br&gt;
&amp;gt; figure or clicked the title bar, etc, as you said. For my&lt;br&gt;
&amp;gt; purposes,&lt;br&gt;
&amp;gt; the above may be enough as my program requires you to click on the&lt;br&gt;
&amp;gt; axes eventually to do anything, but it's a rather silly way to go&lt;br&gt;
&amp;gt; about writing a program.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Perry wrote:&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; Ian,&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; I think what you need here is an 'OnFocus' function, i.e. a&lt;br&gt;
&amp;gt;&amp;gt; function&lt;br&gt;
&amp;gt;&amp;gt; that is called only when the user selcts it, i.e. the figures&lt;br&gt;
&amp;gt;&amp;gt; becomes&lt;br&gt;
&amp;gt;&amp;gt; 'the focus'. The bad part is, I'm not sure Matlab enables you&lt;br&gt;
to&lt;br&gt;
&amp;gt;&amp;gt; specify one. Sure you can 'get the current figure' with gcf,&lt;br&gt;
but&lt;br&gt;
&amp;gt;&amp;gt; you&lt;br&gt;
&amp;gt;&amp;gt; still need to initiate this command when the figure becomes the&lt;br&gt;
&amp;gt;&amp;gt; focus.&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; The nearest thing I can find to achieve this is to specify a&lt;br&gt;
&amp;gt;&amp;gt; WindowButtonDownFcn callback. In this function you could set&lt;br&gt;
some&lt;br&gt;
&amp;gt;&amp;gt; applicationdata that could be read by your control figure as to&lt;br&gt;
&amp;gt;&amp;gt; which&lt;br&gt;
&amp;gt;&amp;gt; figure was last active.&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; NOTE : This function is called when the user presses the mouse&lt;br&gt;
&amp;gt;&amp;gt; button&lt;br&gt;
&amp;gt;&amp;gt; in the figure. It does NOT get called if the user selects the&lt;br&gt;
&amp;gt; title&lt;br&gt;
&amp;gt;&amp;gt; bar or and axis within the figure, so it's not going to work&lt;br&gt;
100%&lt;br&gt;
&amp;gt;&amp;gt; of&lt;br&gt;
&amp;gt;&amp;gt; the time. As I say, Matlab (I don't think) provides an&lt;br&gt;
'OnFocus'&lt;br&gt;
&amp;gt;&amp;gt; callback option.&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; Perry&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; Ian Woloschin wrote:&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; Is it possible to detect when the current figure has&lt;br&gt;
changed&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; through&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; an interrupt/callback?&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; I have a gui control figure that enables features (such as&lt;br&gt;
&amp;gt;&amp;gt; panning)&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; in other figures, but for simplicity, only one figure is&lt;br&gt;
&amp;gt; active&lt;br&gt;
&amp;gt;&amp;gt; at&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; any given time. At this point, you need to go to the&lt;br&gt;
control&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; figure&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; to specify the active figure, but I'd like for the control&lt;br&gt;
&amp;gt; gui&lt;br&gt;
&amp;gt; to&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; automatically update if the current figure switches from,&lt;br&gt;
&amp;gt; say,&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; figure&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; 1 to figure 2.</description>
    </item>
    <item>
      <pubDate>Thu, 01 Jun 2006 15:14:57 -0400</pubDate>
      <title>Re: Interrupt for Current Figure Change</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/125759#316785</link>
      <author>Ian Woloschin</author>
      <description>I'm just using R13 now, as my employer doesn't have a later version.&lt;br&gt;
At school I use R14SP3, I think, but that doesn't help me much.&lt;br&gt;
&lt;br&gt;
I've kind of put this part of my project on the back burner for now,&lt;br&gt;
though I keep making other things work so I'll probably be back to&lt;br&gt;
this in another day or two, heh.&lt;br&gt;
&lt;br&gt;
I'm curious if there is a hidden feature that Matlab uses to do this,&lt;br&gt;
that we might be able to (in a rather ugly manner) hitch onto and use&lt;br&gt;
for our own purposes.&lt;br&gt;
&lt;br&gt;
&amp;nbsp;Perry wrote:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Ian,&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; I agree it probably isn't a good way to go, but I put a post up&lt;br&gt;
&amp;gt; myself asking if anyone knows of an 'OnFocus' callback, but no&lt;br&gt;
&amp;gt; replies as yet. I'm curious myself now as it would be a handy&lt;br&gt;
&amp;gt; function to have access to. I'm Just using a student version, R14&lt;br&gt;
&amp;gt; so&lt;br&gt;
&amp;gt; maybe later versions of Matlab have this facility.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Perry&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; I've considered trying to use the WindowButtonDownFcn, but I&lt;br&gt;
&amp;gt;&amp;gt; haven't&lt;br&gt;
&amp;gt;&amp;gt; done any serious work on that yet. I'm actually using the&lt;br&gt;
&amp;gt;&amp;gt; WindowButtonDownFcn already, but if I compare the figure that's&lt;br&gt;
&amp;gt;&amp;gt; active to the one I think should be active, that would let me&lt;br&gt;
&amp;gt; know&lt;br&gt;
&amp;gt;&amp;gt; if&lt;br&gt;
&amp;gt;&amp;gt; the user made a new figure the current figure.&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; However, this does not take into account if they alt-tabbed&lt;br&gt;
into&lt;br&gt;
&amp;gt;&amp;gt; the&lt;br&gt;
&amp;gt;&amp;gt; figure or clicked the title bar, etc, as you said. For my&lt;br&gt;
&amp;gt;&amp;gt; purposes,&lt;br&gt;
&amp;gt;&amp;gt; the above may be enough as my program requires you to click on&lt;br&gt;
&amp;gt; the&lt;br&gt;
&amp;gt;&amp;gt; axes eventually to do anything, but it's a rather silly way to&lt;br&gt;
go&lt;br&gt;
&amp;gt;&amp;gt; about writing a program.&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; Perry wrote:&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; Ian,&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; I think what you need here is an 'OnFocus' function, i.e. a&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; function&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; that is called only when the user selcts it, i.e. the&lt;br&gt;
figures&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; becomes&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; 'the focus'. The bad part is, I'm not sure Matlab enables&lt;br&gt;
you&lt;br&gt;
&amp;gt; to&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; specify one. Sure you can 'get the current figure' with&lt;br&gt;
gcf,&lt;br&gt;
&amp;gt; but&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; you&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; still need to initiate this command when the figure becomes&lt;br&gt;
&amp;gt; the&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; focus.&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; The nearest thing I can find to achieve this is to specify&lt;br&gt;
a&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; WindowButtonDownFcn callback. In this function you could&lt;br&gt;
set&lt;br&gt;
&amp;gt; some&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; applicationdata that could be read by your control figure&lt;br&gt;
as&lt;br&gt;
&amp;gt; to&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; which&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; figure was last active.&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; NOTE : This function is called when the user presses the&lt;br&gt;
&amp;gt; mouse&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; button&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; in the figure. It does NOT get called if the user selects&lt;br&gt;
the&lt;br&gt;
&amp;gt;&amp;gt; title&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; bar or and axis within the figure, so it's not going to&lt;br&gt;
work&lt;br&gt;
&amp;gt; 100%&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; of&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; the time. As I say, Matlab (I don't think) provides an&lt;br&gt;
&amp;gt; 'OnFocus'&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; callback option.&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; Perry&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; Ian Woloschin wrote:&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&amp;gt; Is it possible to detect when the current figure has&lt;br&gt;
&amp;gt; changed&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&amp;gt; through&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&amp;gt; an interrupt/callback?&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&amp;gt; I have a gui control figure that enables features (such&lt;br&gt;
&amp;gt; as&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; panning)&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&amp;gt; in other figures, but for simplicity, only one figure&lt;br&gt;
is&lt;br&gt;
&amp;gt;&amp;gt; active&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; at&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&amp;gt; any given time. At this point, you need to go to the&lt;br&gt;
&amp;gt; control&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&amp;gt; figure&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&amp;gt; to specify the active figure, but I'd like for the&lt;br&gt;
&amp;gt; control&lt;br&gt;
&amp;gt;&amp;gt; gui&lt;br&gt;
&amp;gt;&amp;gt; to&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&amp;gt; automatically update if the current figure switches&lt;br&gt;
from,&lt;br&gt;
&amp;gt;&amp;gt; say,&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&amp;gt; figure&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&amp;gt; 1 to figure 2.</description>
    </item>
  </channel>
</rss>

