<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/169106</link>
    <title>MATLAB Central Newsreader - Focus loss using keypresses in 'listbox' GUI control</title>
    <description>Feed for thread: Focus loss using keypresses in 'listbox' GUI control</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>Mon, 12 May 2008 14:16:04 -0400</pubDate>
      <title>Focus loss using keypresses in 'listbox' GUI control</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/169106#431566</link>
      <author>Ian Clarkson</author>
      <description>Hi everybody,&lt;br&gt;
&lt;br&gt;
I'm having some issues with R12.1 trying to do a GUI to&lt;br&gt;
display images. I have a list of files in a listbox, and I&lt;br&gt;
want the axis in the GUI to update with the image that's&lt;br&gt;
selected in the listbox. It currently works fine with a&lt;br&gt;
mouse-click, but I want it to update as I move the&lt;br&gt;
highlighted file in the listbox with the arrow keys. The&lt;br&gt;
highlighting works fine UNTIL I try to draw the image. In&lt;br&gt;
the callback function for the listbox, I have:&lt;br&gt;
&lt;br&gt;
axes(handles.axesSampleImage);&lt;br&gt;
imshow(data);&lt;br&gt;
&lt;br&gt;
If I comment out these two lines, the arrow keys continue to&lt;br&gt;
slide the selected string around. However, once the axes()&lt;br&gt;
command is issued (even by itself) or imshow (again, even by&lt;br&gt;
itself), the up and down keypresses start going through&lt;br&gt;
previous/next MATLAB commands back in the main window.&lt;br&gt;
&lt;br&gt;
I've tried returning focus to the listbox by setting its&lt;br&gt;
visibility off and then on again, and setting focus back to&lt;br&gt;
the figure by calling figure(myhandle). Neither works. I'm&lt;br&gt;
not sure what's changing with the axes() and/or imshow()&lt;br&gt;
commands that makes the GUI lose the ability to send&lt;br&gt;
keypresses to the listbox.&lt;br&gt;
&lt;br&gt;
Thanks!</description>
    </item>
    <item>
      <pubDate>Mon, 12 May 2008 15:18:03 -0400</pubDate>
      <title>Re: Focus loss using keypresses in 'listbox' GUI control</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/169106#431576</link>
      <author>matt dash</author>
      <description>I have a similar setup where you can scroll through&lt;br&gt;
variables in a list and they are plotted, and it works fine.&lt;br&gt;
(With no need to re-set focus). Maybe try using the image&lt;br&gt;
command instead of imshow, and specify the axes as a&lt;br&gt;
property of the image instead of using the axes command. </description>
    </item>
    <item>
      <pubDate>Mon, 12 May 2008 16:38:04 -0400</pubDate>
      <title>Re: Focus loss using keypresses in 'listbox' GUI control</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/169106#431596</link>
      <author>Ian Clarkson</author>
      <description>&quot;matt dash&quot; &amp;lt;n.a@mail.com&amp;gt; wrote in message&lt;br&gt;
&amp;lt;g09n3b$ik6$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; I have a similar setup where you can scroll through&lt;br&gt;
&amp;gt; variables in a list and they are plotted, and it works fine.&lt;br&gt;
&amp;gt; (With no need to re-set focus). Maybe try using the image&lt;br&gt;
&amp;gt; command instead of imshow, and specify the axes as a&lt;br&gt;
&amp;gt; property of the image instead of using the axes command. &lt;br&gt;
&lt;br&gt;
Wicked -- that's totally the solution. Create an image&lt;br&gt;
object using the image() function, then set its properties&lt;br&gt;
accordingly. Focus does not change and the keypresses still&lt;br&gt;
work.&lt;br&gt;
&lt;br&gt;
Thanks so much!</description>
    </item>
  </channel>
</rss>

