<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/163585</link>
    <title>MATLAB Central Newsreader - Event queuing , callbacks and buttons</title>
    <description>Feed for thread: Event queuing , callbacks and buttons</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>Tue, 12 Feb 2008 09:42:01 -0500</pubDate>
      <title>Event queuing , callbacks and buttons</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/163585#414411</link>
      <author>Johannes </author>
      <description>Hello,&lt;br&gt;
&lt;br&gt;
I've a gui with a button which increases an interpolation&lt;br&gt;
number. The button then calls a plot function which takes&lt;br&gt;
about 2 seconds to draw. So when the user presses the button&lt;br&gt;
several times the value increases and the plot function is&lt;br&gt;
also called several times which takes really a long time.&lt;br&gt;
What I want to do is to only execute the last call of the&lt;br&gt;
interpolation button. In other words the preceeding calls&lt;br&gt;
should be canceled and only the last call should be&lt;br&gt;
processed. I've read a lot in the newsgroup but didn't find&lt;br&gt;
a satisfying answer. I also have no while or for loops in my&lt;br&gt;
plot function. So the question is, how can I stop the&lt;br&gt;
running plot function?&lt;br&gt;
&lt;br&gt;
Remarks: I don't want to cancel upcoming events I only want&lt;br&gt;
to process the latest call of the interpolation button.&lt;br&gt;
&lt;br&gt;
I hope I made myself clear and would  appreciate any answer.&lt;br&gt;
&lt;br&gt;
Thanks and greetings,&lt;br&gt;
Johannes.</description>
    </item>
    <item>
      <pubDate>Tue, 12 Feb 2008 17:21:51 -0500</pubDate>
      <title>Re: Event queuing , callbacks and buttons</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/163585#414549</link>
      <author>roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)</author>
      <description>In article &amp;lt;forpl9$8cv$1@fred.mathworks.com&amp;gt;,&lt;br&gt;
Johannes  &amp;lt;RudiRocker@gmx.net&amp;gt; wrote:&lt;br&gt;
&lt;br&gt;
&amp;gt;I've a gui with a button which increases an interpolation&lt;br&gt;
&amp;gt;number. The button then calls a plot function which takes&lt;br&gt;
&amp;gt;about 2 seconds to draw. So when the user presses the button&lt;br&gt;
&amp;gt;several times the value increases and the plot function is&lt;br&gt;
&amp;gt;also called several times which takes really a long time.&lt;br&gt;
&amp;gt;What I want to do is to only execute the last call of the&lt;br&gt;
&amp;gt;interpolation button.&lt;br&gt;
&lt;br&gt;
The thread &quot;callbacks / recursion limit&quot;, Jan 14,&lt;br&gt;
roberson@ibd.nrc-cnrc.gc.ca, might provide you with some ideas&lt;br&gt;
on how to handle this.&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
I see you are using the Mathworks news reader, so the following&lt;br&gt;
link will show up split over two lines for you; you will&lt;br&gt;
need to paste the pieces into your address bar.&lt;br&gt;
&lt;br&gt;
&lt;a href=&quot;http://groups.google.ca/group/comp.soft-sys.matlab/browse_thread/thread/c385540fcf4832e8&quot;&gt;http://groups.google.ca/group/comp.soft-sys.matlab/browse_thread/thread/c385540fcf4832e8&lt;/a&gt;&lt;br&gt;
-- &lt;br&gt;
&amp;nbsp;&amp;nbsp;&quot;Prevention is the daughter of intelligence.&quot;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;-- Sir Walter Raleigh</description>
    </item>
    <item>
      <pubDate>Tue, 12 Feb 2008 22:20:18 -0500</pubDate>
      <title>Re: Event queuing , callbacks and buttons</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/163585#414630</link>
      <author>Johannes </author>
      <description>&amp;gt; The thread &quot;callbacks / recursion limit&quot;, Jan 14,&lt;br&gt;
&amp;gt; roberson@ibd.nrc-cnrc.gc.ca, might provide you with some ideas&lt;br&gt;
&amp;gt; on how to handle this.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I see you are using the Mathworks news reader, so the following&lt;br&gt;
&amp;gt; link will show up split over two lines for you; you will&lt;br&gt;
&amp;gt; need to paste the pieces into your address bar.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;a href=&quot;http://groups.google.ca/group/comp.soft-&quot;&gt;http://groups.google.ca/group/comp.soft-&lt;/a&gt;&lt;br&gt;
sys.matlab/browse_thread/thread/c385540fcf4832e8&lt;br&gt;
&amp;gt; -- &lt;br&gt;
&amp;gt;   &quot;Prevention is the daughter of intelligence.&quot;&lt;br&gt;
&amp;gt;                                               -- Sir Walter Raleigh&lt;br&gt;
&lt;br&gt;
Thanks for your answer. But I've already read the thread and I couldn't figure &lt;br&gt;
out how it should help me. What I want to do is that when the button gets hit &lt;br&gt;
twice it should only execute the last callback and the first callback should be &lt;br&gt;
interrupted and never continued again. So wouldn't limitating the recursion &lt;br&gt;
limit cause an interruption of the last callback?&lt;br&gt;
&lt;br&gt;
Greetings,&lt;br&gt;
Johannes&lt;br&gt;
&lt;br&gt;
&amp;nbsp;</description>
    </item>
    <item>
      <pubDate>Tue, 12 Feb 2008 22:44:08 -0500</pubDate>
      <title>Re: Event queuing , callbacks and buttons</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/163585#414636</link>
      <author>roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)</author>
      <description>In article &amp;lt;fot632$pgq$1@fred.mathworks.com&amp;gt;,&lt;br&gt;
Johannes  &amp;lt;RudiRocker@gmx.net&amp;gt; wrote:&lt;br&gt;
&amp;gt;What I want to do is that when the button gets hit &lt;br&gt;
&amp;gt;twice it should only execute the last callback and the first callback should be &lt;br&gt;
&amp;gt;interrupted and never continued again.&lt;br&gt;
&lt;br&gt;
It is easier to arrange it the other way around.&lt;br&gt;
&lt;br&gt;
Have a global flag &quot;interrupted&quot; that you clear before any of&lt;br&gt;
the activity begins.&lt;br&gt;
&lt;br&gt;
You get a click, you enter the callback&lt;br&gt;
routine. You test the flag: if it is clear, then you fetch&lt;br&gt;
the current parameter values and operate on them, checking&lt;br&gt;
from time to time whether the flag is still clear. If the flag&lt;br&gt;
never becomes set before you have reached the end of the calculation,&lt;br&gt;
then you were not interrupted and you should finish up normally.&lt;br&gt;
&lt;br&gt;
When you test the flag the first time upon entry into the routine&lt;br&gt;
and you find it set, then you fetch the current parameter values&lt;br&gt;
(CurrentPoint, gcbo, whatever you need that identifies that&lt;br&gt;
click uniquely) and store them in a global variable, and you leave&lt;br&gt;
the flag set and you exit.&lt;br&gt;
&lt;br&gt;
When you test the flag in the middle of the calculation routine&lt;br&gt;
and you find that it has been set, you abandon the current calculation,&lt;br&gt;
head back to the top of the routine, fetch the parameter values&lt;br&gt;
from the global variable, clear the flag, and start the&lt;br&gt;
calculation again.&lt;br&gt;
&lt;br&gt;
If you try to do it the other way around, cancelling the&lt;br&gt;
&quot;older&quot; incarnations but continuing to run the newest, I think&lt;br&gt;
you will find it harder to decide whether you are in the &quot;newest&quot;&lt;br&gt;
or not.&lt;br&gt;
-- &lt;br&gt;
&amp;nbsp;&amp;nbsp;&quot;Every intellectual product must be judged from the point of view&lt;br&gt;
&amp;nbsp;&amp;nbsp;of the age and the people in which it was produced.&quot;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;-- Walter Horatio Pater</description>
    </item>
    <item>
      <pubDate>Wed, 13 Feb 2008 15:15:28 -0500</pubDate>
      <title>Re: Event queuing , callbacks and buttons</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/163585#414794</link>
      <author>Johannes </author>
      <description>Thanks for your answer.&lt;br&gt;
&lt;br&gt;
I also thought of a solution like that but I think it's not&lt;br&gt;
a very nice one and has one main problem. My executing&lt;br&gt;
function invokes several other functions and also uses some&lt;br&gt;
toolboxes. So if I would like to implement that solution I&lt;br&gt;
would also have to implement it in the toolboxes, because&lt;br&gt;
they are the ones which need some time to execute.&lt;br&gt;
So I assume there isn't a possibility to control the&lt;br&gt;
callbacks in queue and cancel an executing function?&lt;br&gt;
&lt;br&gt;
Greetings,&lt;br&gt;
Johannes</description>
    </item>
    <item>
      <pubDate>Wed, 13 Feb 2008 19:27:05 -0500</pubDate>
      <title>Re: Event queuing , callbacks and buttons</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/163585#414886</link>
      <author>roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)</author>
      <description>In article &amp;lt;fov1ig$enp$1@fred.mathworks.com&amp;gt;,&lt;br&gt;
Johannes  &amp;lt;RudiRocker@gmx.net&amp;gt; wrote:&lt;br&gt;
&lt;br&gt;
&amp;gt;I also thought of a solution like that but I think it's not&lt;br&gt;
&amp;gt;a very nice one and has one main problem. My executing&lt;br&gt;
&amp;gt;function invokes several other functions and also uses some&lt;br&gt;
&amp;gt;toolboxes. So if I would like to implement that solution I&lt;br&gt;
&amp;gt;would also have to implement it in the toolboxes, because&lt;br&gt;
&amp;gt;they are the ones which need some time to execute.&lt;br&gt;
&amp;gt;So I assume there isn't a possibility to control the&lt;br&gt;
&amp;gt;callbacks in queue and cancel an executing function?&lt;br&gt;
&lt;br&gt;
In a number of the internal Matlab functions, the ones&lt;br&gt;
written in something other than Matlab, there are no checks&lt;br&gt;
to see if the user (or anything else) has requested an interruption.&lt;br&gt;
The only way to abort those time-consuming functions is to shoot&lt;br&gt;
the entire Matlab process.&lt;br&gt;
-- &lt;br&gt;
&amp;nbsp;&amp;nbsp;&quot;Beauty, like all other qualities presented to human experience,&lt;br&gt;
&amp;nbsp;&amp;nbsp;is relative; and the definition of it becomes unmeaning and&lt;br&gt;
&amp;nbsp;&amp;nbsp;useless in proportion to its abstractness.&quot; -- Walter Pater</description>
    </item>
  </channel>
</rss>

