<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Detecting window focus events</title>
	<atom:link href="http://undocumentedmatlab.com/blog/detecting-window-focus-events/feed/" rel="self" type="application/rss+xml" />
	<link>http://undocumentedmatlab.com/blog/detecting-window-focus-events/</link>
	<description>Charting Matlab's unsupported hidden underbelly</description>
	<lastBuildDate>Tue, 07 Sep 2010 22:25:59 -0700</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Kesh</title>
		<link>http://undocumentedmatlab.com/blog/detecting-window-focus-events/comment-page-1/#comment-14853</link>
		<dc:creator>Kesh</dc:creator>
		<pubDate>Mon, 09 Aug 2010 17:22:11 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=584#comment-14853</guid>
		<description>@Donn, thanks for the tip! That&#039;ll do for me.</description>
		<content:encoded><![CDATA[<p>@Donn, thanks for the tip! That&#8217;ll do for me.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Donn</title>
		<link>http://undocumentedmatlab.com/blog/detecting-window-focus-events/comment-page-1/#comment-14684</link>
		<dc:creator>Donn</dc:creator>
		<pubDate>Sat, 07 Aug 2010 19:13:01 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=584#comment-14684</guid>
		<description>@Kesh – Even though the callback properties are not available the corresponding events are still generated. You can create listeners to them with:

&lt;pre lang=&quot;matlab&quot;&gt;
   l = handle.listener(handle(jAxis), &#039;FocusGained&#039;, @callback)
&lt;/pre&gt;

It is not as convienent as the callback properties, but it works.</description>
		<content:encoded><![CDATA[<p>@Kesh – Even though the callback properties are not available the corresponding events are still generated. You can create listeners to them with:</p>

<div class="wp_syntax"><div class="code"><pre class="matlab" style="font-family:monospace;">   l = <span style="color: #0000FF;">handle.<span style="">listener</span></span><span style="color: #080;">&#40;</span>handle<span style="color: #080;">&#40;</span>jAxis<span style="color: #080;">&#41;</span>, <span style="color:#A020F0;">'FocusGained'</span>, @callback<span style="color: #080;">&#41;</span></pre></div></div>

<p>It is not as convienent as the callback properties, but it works.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kesh</title>
		<link>http://undocumentedmatlab.com/blog/detecting-window-focus-events/comment-page-1/#comment-14477</link>
		<dc:creator>Kesh</dc:creator>
		<pubDate>Thu, 05 Aug 2010 18:59:20 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=584#comment-14477</guid>
		<description>That&#039;s a bummer. I wonder if there is any way for us to &quot;attach&quot; CallbackProperties after FIG is loaded... If you learn a way around for it, please let me know!</description>
		<content:encoded><![CDATA[<p>That&#8217;s a bummer. I wonder if there is any way for us to &#8220;attach&#8221; CallbackProperties after FIG is loaded&#8230; If you learn a way around for it, please let me know!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Yair Altman</title>
		<link>http://undocumentedmatlab.com/blog/detecting-window-focus-events/comment-page-1/#comment-14472</link>
		<dc:creator>Yair Altman</dc:creator>
		<pubDate>Thu, 05 Aug 2010 18:01:44 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=584#comment-14472</guid>
		<description>@Kesh - this is an undocumented bug in the way Matlab loads FIG files - it loads Java objects without the &lt;a target=&quot;_blank&quot; href=&quot;http://undocumentedmatlab.com/blog/uicontrol-callbacks/#memory_leak&quot; rel=&quot;nofollow&quot;&gt;&#039;CallbackProperties&#039; argument&lt;/a&gt; (so some equivalent action), causing the object&#039;s callbacks not to be visible in Matlab.

Apparently, only GUI figures and components created in run-time have accessible callbacks. This sounds odd, and I would love to learn how to bypass this limitation, but at the moment I don&#039;t know if this is possible.</description>
		<content:encoded><![CDATA[<p>@Kesh &#8211; this is an undocumented bug in the way Matlab loads FIG files &#8211; it loads Java objects without the <a target="_blank" href="http://undocumentedmatlab.com/blog/uicontrol-callbacks/#memory_leak" rel="nofollow">&#8216;CallbackProperties&#8217; argument</a> (so some equivalent action), causing the object&#8217;s callbacks not to be visible in Matlab.</p>
<p>Apparently, only GUI figures and components created in run-time have accessible callbacks. This sounds odd, and I would love to learn how to bypass this limitation, but at the moment I don&#8217;t know if this is possible.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kesh</title>
		<link>http://undocumentedmatlab.com/blog/detecting-window-focus-events/comment-page-1/#comment-14205</link>
		<dc:creator>Kesh</dc:creator>
		<pubDate>Mon, 02 Aug 2010 14:43:46 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=584#comment-14205</guid>
		<description>Oops, I mistakenly placed &quot;&quot; text in MATLAB code block. For the first get(jAxis) returned values, there are many other Callback Fields between &quot;MouseWheelMovedCallbackData = []&quot; and &quot;	KeyTypedCallback = &quot;</description>
		<content:encoded><![CDATA[<p>Oops, I mistakenly placed &#8220;&#8221; text in MATLAB code block. For the first get(jAxis) returned values, there are many other Callback Fields between &#8220;MouseWheelMovedCallbackData = []&#8221; and &#8221;	KeyTypedCallback = &#8220;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kesh</title>
		<link>http://undocumentedmatlab.com/blog/detecting-window-focus-events/comment-page-1/#comment-14204</link>
		<dc:creator>Kesh</dc:creator>
		<pubDate>Mon, 02 Aug 2010 14:41:22 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=584#comment-14204</guid>
		<description>Hey Yair,

It&#039;s me again. I got a funny behavior when trying to access figure focus callbacks of saved figure. Here&#039;s an example:

Open a plain figure with nothing in it and get the AxisComponent properties:

&lt;pre lang=&quot;matlab&quot;&gt;
figure
jFig = get(handle(gcf), &#039;JavaFrame&#039;);
jAxis = jFig.getAxisComponent;
get(jAxis)
&lt;/pre&gt;

returns what we expect:

&lt;pre lang=&quot;matlab&quot;&gt;
	UIJGraphics = []
	AccessibleContext = [ (1 by 1) java.awt.Canvas$AccessibleAWTCanvas array]
	Background = [0.92549 0.913725 0.847059]
	BufferStrategy = []
	Component = [ (1 by 1) com.mathworks.hg.peer.FigureAxisComponentProxy$_AxisCanvas array]
	ComponentLightweight = off
	Enabled = on
	Focusable = on
	Font = [ (1 by 1) javax.swing.plaf.FontUIResource array]
	Foreground = [0 0 0]
	Graphics = [ (1 by 1) com.mathworks.hg.peer.AxisCanvas$HGDebugGraphics array]
	Name = fAxisComponentProxy
	NativeWindowHandle = [0]
	NativeWindowHandleValid = off
	MouseWheelMovedCallback = 
	MouseWheelMovedCallbackData = []
	
	KeyTypedCallback = 
	KeyTypedCallbackData = []

	BeingDeleted = off
	ButtonDownFcn = 
	Children = []
	Clipping = on
	CreateFcn = 
	DeleteFcn = 
	BusyAction = queue
	HandleVisibility = on
	HitTest = on
	Interruptible = on
	Parent = []
	Selected = off
	SelectionHighlight = on
	Tag = 
	Type = com.mathworks.hg.peer.FigureAxisComponentProxy$_AxisCanvas
	UIContextMenu = []
	UserData = []
	Visible = on
&lt;/pre&gt;

But, when this figure is saved and loaded again:

&lt;pre lang=&quot;matlab&quot;&gt;
hgsave test
hgload test

jFig1 = get(handle(gcf), &#039;JavaFrame&#039;);
jAxis1 = jFig1.getAxisComponent;
get(jAxis1)
&lt;/pre&gt;

Now, AxisComponent properties are crippled:

&lt;pre lang=&quot;matlab&quot;&gt;
                UIJGraphics: []
          AccessibleContext: [1x1 java.awt.Canvas$AccessibleAWTCanvas]
                 Background: [1x1 javax.swing.plaf.ColorUIResource]
             BufferStrategy: []
                  Component: [1x1 com.mathworks.hg.peer.FigureAxisComponentProxy$_AxisCanvas]
       ComponentLightweight: 0
                    Enabled: 1
                  Focusable: 1
                       Font: [1x1 javax.swing.plaf.FontUIResource]
                 Foreground: [1x1 javax.swing.plaf.ColorUIResource]
                   Graphics: [1x1 com.mathworks.hg.peer.AxisCanvas$HGDebugGraphics]
                       Name: &#039;fAxisComponentProxy&#039;
         NativeWindowHandle: 0
    NativeWindowHandleValid: 0
&lt;/pre&gt;

The callback fields are no longer accessible among many others. Do you know why this happens and/or how to work around this problem to get to the focus callbacks?

TIA</description>
		<content:encoded><![CDATA[<p>Hey Yair,</p>
<p>It&#8217;s me again. I got a funny behavior when trying to access figure focus callbacks of saved figure. Here&#8217;s an example:</p>
<p>Open a plain figure with nothing in it and get the AxisComponent properties:</p>

<div class="wp_syntax"><div class="code"><pre class="matlab" style="font-family:monospace;"><span style="color: #0000FF;">figure</span>
jFig = <span style="color: #0000FF;">get</span><span style="color: #080;">&#40;</span>handle<span style="color: #080;">&#40;</span><span style="color: #0000FF;">gcf</span><span style="color: #080;">&#41;</span>, <span style="color:#A020F0;">'JavaFrame'</span><span style="color: #080;">&#41;</span>;
jAxis = jFig.<span style="">getAxisComponent</span>;
<span style="color: #0000FF;">get</span><span style="color: #080;">&#40;</span>jAxis<span style="color: #080;">&#41;</span></pre></div></div>

<p>returns what we expect:</p>

<div class="wp_syntax"><div class="code"><pre class="matlab" style="font-family:monospace;">	UIJGraphics = <span style="color: #080;">&#91;</span><span style="color: #080;">&#93;</span>
	AccessibleContext = <span style="color: #080;">&#91;</span> <span style="color: #080;">&#40;</span><span style="color: #33f;">1</span> by <span style="color: #33f;">1</span><span style="color: #080;">&#41;</span> java.<span style="">awt</span>.<span style="">Canvas</span>$AccessibleAWTCanvas array<span style="color: #080;">&#93;</span>
	Background = <span style="color: #080;">&#91;</span><span style="color: #33f;">0.92549</span> <span style="color: #33f;">0.913725</span> <span style="color: #33f;">0.847059</span><span style="color: #080;">&#93;</span>
	BufferStrategy = <span style="color: #080;">&#91;</span><span style="color: #080;">&#93;</span>
	Component = <span style="color: #080;">&#91;</span> <span style="color: #080;">&#40;</span><span style="color: #33f;">1</span> by <span style="color: #33f;">1</span><span style="color: #080;">&#41;</span> com.<span style="">mathworks</span>.<span style="">hg</span>.<span style="">peer</span>.<span style="">FigureAxisComponentProxy</span>$_AxisCanvas array<span style="color: #080;">&#93;</span>
	ComponentLightweight = off
	Enabled = on
	Focusable = on
	Font = <span style="color: #080;">&#91;</span> <span style="color: #080;">&#40;</span><span style="color: #33f;">1</span> by <span style="color: #33f;">1</span><span style="color: #080;">&#41;</span> javax.<span style="">swing</span>.<span style="">plaf</span>.<span style="">FontUIResource</span> array<span style="color: #080;">&#93;</span>
	Foreground = <span style="color: #080;">&#91;</span><span style="color: #33f;">0</span> <span style="color: #33f;">0</span> <span style="color: #33f;">0</span><span style="color: #080;">&#93;</span>
	Graphics = <span style="color: #080;">&#91;</span> <span style="color: #080;">&#40;</span><span style="color: #33f;">1</span> by <span style="color: #33f;">1</span><span style="color: #080;">&#41;</span> com.<span style="">mathworks</span>.<span style="">hg</span>.<span style="">peer</span>.<span style="">AxisCanvas</span>$HGDebugGraphics array<span style="color: #080;">&#93;</span>
	Name = fAxisComponentProxy
	NativeWindowHandle = <span style="color: #080;">&#91;</span><span style="color: #33f;">0</span><span style="color: #080;">&#93;</span>
	NativeWindowHandleValid = off
	MouseWheelMovedCallback = 
	MouseWheelMovedCallbackData = <span style="color: #080;">&#91;</span><span style="color: #080;">&#93;</span>
&nbsp;
	KeyTypedCallback = 
	KeyTypedCallbackData = <span style="color: #080;">&#91;</span><span style="color: #080;">&#93;</span>
&nbsp;
	BeingDeleted = off
	ButtonDownFcn = 
	Children = <span style="color: #080;">&#91;</span><span style="color: #080;">&#93;</span>
	Clipping = on
	CreateFcn = 
	DeleteFcn = 
	BusyAction = queue
	HandleVisibility = on
	HitTest = on
	Interruptible = on
	Parent = <span style="color: #080;">&#91;</span><span style="color: #080;">&#93;</span>
	Selected = off
	SelectionHighlight = on
	Tag = 
	<span style="color: #0000FF;">Type</span> = com.<span style="">mathworks</span>.<span style="">hg</span>.<span style="">peer</span>.<span style="">FigureAxisComponentProxy</span>$_AxisCanvas
	<span style="color: #0000FF;">UIContextMenu</span> = <span style="color: #080;">&#91;</span><span style="color: #080;">&#93;</span>
	UserData = <span style="color: #080;">&#91;</span><span style="color: #080;">&#93;</span>
	Visible = on</pre></div></div>

<p>But, when this figure is saved and loaded again:</p>

<div class="wp_syntax"><div class="code"><pre class="matlab" style="font-family:monospace;">hgsave test
hgload test
&nbsp;
jFig1 = <span style="color: #0000FF;">get</span><span style="color: #080;">&#40;</span>handle<span style="color: #080;">&#40;</span><span style="color: #0000FF;">gcf</span><span style="color: #080;">&#41;</span>, <span style="color:#A020F0;">'JavaFrame'</span><span style="color: #080;">&#41;</span>;
jAxis1 = jFig1.<span style="">getAxisComponent</span>;
<span style="color: #0000FF;">get</span><span style="color: #080;">&#40;</span>jAxis1<span style="color: #080;">&#41;</span></pre></div></div>

<p>Now, AxisComponent properties are crippled:</p>

<div class="wp_syntax"><div class="code"><pre class="matlab" style="font-family:monospace;">                UIJGraphics<span style="color: #F0F;">:</span> <span style="color: #080;">&#91;</span><span style="color: #080;">&#93;</span>
          AccessibleContext<span style="color: #F0F;">:</span> <span style="color: #080;">&#91;</span>1x1 java.<span style="">awt</span>.<span style="">Canvas</span>$AccessibleAWTCanvas<span style="color: #080;">&#93;</span>
                 Background<span style="color: #F0F;">:</span> <span style="color: #080;">&#91;</span>1x1 javax.<span style="">swing</span>.<span style="">plaf</span>.<span style="">ColorUIResource</span><span style="color: #080;">&#93;</span>
             BufferStrategy<span style="color: #F0F;">:</span> <span style="color: #080;">&#91;</span><span style="color: #080;">&#93;</span>
                  Component<span style="color: #F0F;">:</span> <span style="color: #080;">&#91;</span>1x1 com.<span style="">mathworks</span>.<span style="">hg</span>.<span style="">peer</span>.<span style="">FigureAxisComponentProxy</span>$_AxisCanvas<span style="color: #080;">&#93;</span>
       ComponentLightweight<span style="color: #F0F;">:</span> <span style="color: #33f;">0</span>
                    Enabled<span style="color: #F0F;">:</span> <span style="color: #33f;">1</span>
                  Focusable<span style="color: #F0F;">:</span> <span style="color: #33f;">1</span>
                       Font<span style="color: #F0F;">:</span> <span style="color: #080;">&#91;</span>1x1 javax.<span style="">swing</span>.<span style="">plaf</span>.<span style="">FontUIResource</span><span style="color: #080;">&#93;</span>
                 Foreground<span style="color: #F0F;">:</span> <span style="color: #080;">&#91;</span>1x1 javax.<span style="">swing</span>.<span style="">plaf</span>.<span style="">ColorUIResource</span><span style="color: #080;">&#93;</span>
                   Graphics<span style="color: #F0F;">:</span> <span style="color: #080;">&#91;</span>1x1 com.<span style="">mathworks</span>.<span style="">hg</span>.<span style="">peer</span>.<span style="">AxisCanvas</span>$HGDebugGraphics<span style="color: #080;">&#93;</span>
                       Name<span style="color: #F0F;">:</span> <span style="color:#A020F0;">'fAxisComponentProxy'</span>
         NativeWindowHandle<span style="color: #F0F;">:</span> <span style="color: #33f;">0</span>
    NativeWindowHandleValid<span style="color: #F0F;">:</span> <span style="color: #33f;">0</span></pre></div></div>

<p>The callback fields are no longer accessible among many others. Do you know why this happens and/or how to work around this problem to get to the focus callbacks?</p>
<p>TIA</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Yair Altman</title>
		<link>http://undocumentedmatlab.com/blog/detecting-window-focus-events/comment-page-1/#comment-13963</link>
		<dc:creator>Yair Altman</dc:creator>
		<pubDate>Fri, 30 Jul 2010 09:32:13 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=584#comment-13963</guid>
		<description>@David - have a look here: http://UndocumentedMatlab.com/blog/uicontrol-callbacks/
I don&#039;t have an immediate solution to the performance issue. JTextArea is usually performant, since it doesn&#039;t have different fonts/styles like JEditorPane or JTextPane. Perhaps the bottleneck is in one of your callbacks or listeners?</description>
		<content:encoded><![CDATA[<p>@David &#8211; have a look here: <a href="http://UndocumentedMatlab.com/blog/uicontrol-callbacks/" rel="nofollow">http://UndocumentedMatlab.com/blog/uicontrol-callbacks/</a><br />
I don&#8217;t have an immediate solution to the performance issue. JTextArea is usually performant, since it doesn&#8217;t have different fonts/styles like JEditorPane or JTextPane. Perhaps the bottleneck is in one of your callbacks or listeners?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David</title>
		<link>http://undocumentedmatlab.com/blog/detecting-window-focus-events/comment-page-1/#comment-13957</link>
		<dc:creator>David</dc:creator>
		<pubDate>Fri, 30 Jul 2010 07:47:02 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=584#comment-13957</guid>
		<description>Hi,

I am working with a java component in matlab. I have wrapped a JTextArea and added a scroll and some features to it. I have two problems that I would like to solve:

1) I need a callback to use when something changes in the text area. I would like to use this to implement a UNDO, crl+z, feature. Do you know a suitable callback for this?

2) When I work with the text area it is very slow to render and repaint. If i delete some text, paste large blocks etc it might not render. I have tried calling repaint without success. Do you have a solution for this?

-David</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>I am working with a java component in matlab. I have wrapped a JTextArea and added a scroll and some features to it. I have two problems that I would like to solve:</p>
<p>1) I need a callback to use when something changes in the text area. I would like to use this to implement a UNDO, crl+z, feature. Do you know a suitable callback for this?</p>
<p>2) When I work with the text area it is very slow to render and repaint. If i delete some text, paste large blocks etc it might not render. I have tried calling repaint without success. Do you have a solution for this?</p>
<p>-David</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Donn Shull</title>
		<link>http://undocumentedmatlab.com/blog/detecting-window-focus-events/comment-page-1/#comment-2756</link>
		<dc:creator>Donn Shull</dc:creator>
		<pubDate>Sat, 19 Sep 2009 05:36:57 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=584#comment-2756</guid>
		<description>I think I found this in some of your code on the MathWorks file exchange, anyway if you don&#039;t like having to turn warnings off you can use the undocumented use of handle as a function to get the underlying figure object and access the JavaFrame property from there without generating a warning.

&lt;pre lang=&quot;matlab&quot;&gt;
hFig = figure;
obj = handle(hFig);
jFig = obj.JavaFrame;
&lt;/pre&gt;

Thanks for the great work Yair.</description>
		<content:encoded><![CDATA[<p>I think I found this in some of your code on the MathWorks file exchange, anyway if you don&#8217;t like having to turn warnings off you can use the undocumented use of handle as a function to get the underlying figure object and access the JavaFrame property from there without generating a warning.</p>

<div class="wp_syntax"><div class="code"><pre class="matlab" style="font-family:monospace;">hFig = <span style="color: #0000FF;">figure</span>;
obj = handle<span style="color: #080;">&#40;</span>hFig<span style="color: #080;">&#41;</span>;
jFig = obj.<span style="">JavaFrame</span>;</pre></div></div>

<p>Thanks for the great work Yair.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
