<?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: Auto-completion widget	</title>
	<atom:link href="https://undocumentedmatlab.com/articles/auto-completion-widget/feed" rel="self" type="application/rss+xml" />
	<link>https://undocumentedmatlab.com/articles/auto-completion-widget?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=auto-completion-widget</link>
	<description>Professional Matlab consulting, development and training</description>
	<lastBuildDate>Mon, 07 Jan 2019 21:29:31 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.7.2</generator>
	<item>
		<title>
		By: Peter		</title>
		<link>https://undocumentedmatlab.com/articles/auto-completion-widget#comment-457131</link>

		<dc:creator><![CDATA[Peter]]></dc:creator>
		<pubDate>Mon, 07 Jan 2019 21:29:31 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=5763#comment-457131</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/auto-completion-widget#comment-457126&quot;&gt;Peter&lt;/a&gt;.

It seems i solved the issue i reported a couple of hours ago. I use &lt;a href=&quot;http://undocumentedmatlab.com/blog/matlab-and-the-event-dispatch-thread-edt&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;javaObjectEDT&lt;/a&gt; (thanks for explaining that in your other post) on jSearchTextField before the setText invocation..]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/auto-completion-widget#comment-457126">Peter</a>.</p>
<p>It seems i solved the issue i reported a couple of hours ago. I use <a href="http://undocumentedmatlab.com/blog/matlab-and-the-event-dispatch-thread-edt" target="_blank" rel="nofollow">javaObjectEDT</a> (thanks for explaining that in your other post) on jSearchTextField before the setText invocation..</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Peter		</title>
		<link>https://undocumentedmatlab.com/articles/auto-completion-widget#comment-457126</link>

		<dc:creator><![CDATA[Peter]]></dc:creator>
		<pubDate>Mon, 07 Jan 2019 18:34:36 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=5763#comment-457126</guid>

					<description><![CDATA[Hi!

This is quite elegant. Unfortunately, there is a problem with Matlab hanging (matlab 2018b, windows 8.1) in the searchComboUpdated(obj, jCombo, eventData, hPanel) function. The hang occurs at jSearchTextField.setText(selectedItem). From other articles on your blog I learned that it could be EDT related and I hence added the drawnow; pause(0.1); that sometimes solves this. In this case it doesn&#039;t help. In a newly started Matlab I get a hang everytime. It doesn&#039;t hang in debug mode, but as soon as I run it without a breakpoint, it hangs. So frustrating.. and so unfortunate that Matlab has all these issues. I tried longer pause-times as well..didn&#039;t help. Do you have any ideas?

Best,
Peter 

PS: the code:
&lt;pre lang=&quot;matlab&quot;&gt;
function searchComboUpdated(obj, jCombo, eventData, hPanel)
    ptime = 0.1;
    selectedItem = regexprep(char(jCombo.getSelectedItem),&#039;]*&gt;&#039;,&#039;&#039;);  % strip away HTML tags
    fprintf(&#039;1&#039;);

    jSearchTextField = hPanel.UserData(2).getComponent(0);
    fprintf(&#039;2&#039;);
    drawnow; pause(ptime);

    str = java.lang.String(selectedItem);
    drawnow; pause(ptime);
    fprintf(&#039;2b&#039;);
    drawnow; pause(ptime);

    jSearchTextField.setText(str);
    drawnow; pause(ptime);
    fprintf(&#039;3&#039;);
    drawnow; pause(ptime);

    jSearchTextField.repaint; drawnow; pause(0.01);
    fprintf(&#039;4&#039;);

    jAssetChooser = getappdata(hPanel,&#039;jAssetChooser&#039;);
    fprintf(&#039;5&#039;);

    obj.updateSearch([],[],jCombo,jAssetChooser);
    fprintf(&#039;6&#039;);
end  % searchComboUpdated

&lt;/pre&gt;]]></description>
			<content:encoded><![CDATA[<p>Hi!</p>
<p>This is quite elegant. Unfortunately, there is a problem with Matlab hanging (matlab 2018b, windows 8.1) in the searchComboUpdated(obj, jCombo, eventData, hPanel) function. The hang occurs at jSearchTextField.setText(selectedItem). From other articles on your blog I learned that it could be EDT related and I hence added the drawnow; pause(0.1); that sometimes solves this. In this case it doesn&#8217;t help. In a newly started Matlab I get a hang everytime. It doesn&#8217;t hang in debug mode, but as soon as I run it without a breakpoint, it hangs. So frustrating.. and so unfortunate that Matlab has all these issues. I tried longer pause-times as well..didn&#8217;t help. Do you have any ideas?</p>
<p>Best,<br />
Peter </p>
<p>PS: the code:</p>
<pre lang="matlab">
function searchComboUpdated(obj, jCombo, eventData, hPanel)
    ptime = 0.1;
    selectedItem = regexprep(char(jCombo.getSelectedItem),']*>','');  % strip away HTML tags
    fprintf('1');

    jSearchTextField = hPanel.UserData(2).getComponent(0);
    fprintf('2');
    drawnow; pause(ptime);

    str = java.lang.String(selectedItem);
    drawnow; pause(ptime);
    fprintf('2b');
    drawnow; pause(ptime);

    jSearchTextField.setText(str);
    drawnow; pause(ptime);
    fprintf('3');
    drawnow; pause(ptime);

    jSearchTextField.repaint; drawnow; pause(0.01);
    fprintf('4');

    jAssetChooser = getappdata(hPanel,'jAssetChooser');
    fprintf('5');

    obj.updateSearch([],[],jCombo,jAssetChooser);
    fprintf('6');
end  % searchComboUpdated

</pre>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Stev		</title>
		<link>https://undocumentedmatlab.com/articles/auto-completion-widget#comment-445154</link>

		<dc:creator><![CDATA[Stev]]></dc:creator>
		<pubDate>Fri, 05 Oct 2018 06:03:12 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=5763#comment-445154</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/auto-completion-widget#comment-401969&quot;&gt;Johan&lt;/a&gt;.

Hello together,

I am iteressted in the same point. I can implemement

&lt;pre lang=&quot;matlab&quot;&gt;
set(handle(jPanelObj,&#039;callbackproperties&#039;), &#039;ActionPerformedCallback&#039;, @myMatlabCallbackFunc);
 &lt;/pre&gt;

and this works fine, but with this callback I can not trigger on return or enter.

Do anybody have an idea to this topic.

Best Regards Stev]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/auto-completion-widget#comment-401969">Johan</a>.</p>
<p>Hello together,</p>
<p>I am iteressted in the same point. I can implemement</p>
<pre lang="matlab">
set(handle(jPanelObj,'callbackproperties'), 'ActionPerformedCallback', @myMatlabCallbackFunc);
 </pre>
<p>and this works fine, but with this callback I can not trigger on return or enter.</p>
<p>Do anybody have an idea to this topic.</p>
<p>Best Regards Stev</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Yair Altman		</title>
		<link>https://undocumentedmatlab.com/articles/auto-completion-widget#comment-426750</link>

		<dc:creator><![CDATA[Yair Altman]]></dc:creator>
		<pubDate>Tue, 22 May 2018 09:22:42 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=5763#comment-426750</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/auto-completion-widget#comment-425582&quot;&gt;Peter&lt;/a&gt;.

@Peter - My aim in this post, as in my entire blog, is to provide general guidelines, code snippets and sample output. I expect my readers to fill in the missing blanks. Admittedly, not all readers can do this, but I aim high, unapologetically. I rarely spoon-feed users with complete code programs. This would be quite beyond the scope of a typical blog post, or the amount of time that I can spend pro-bono. Remember that this blog has 400 articles, so if I had to spend a full day on each one, this would translate to almost two full work-&lt;b&gt;years&lt;/b&gt;! 

I have now added some extra code and explanations to the main text, which should be more than enough for most Matlab developers. If it&#039;s still not enough for you, then consider asking a professional Matlab developer to assist you.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/auto-completion-widget#comment-425582">Peter</a>.</p>
<p>@Peter &#8211; My aim in this post, as in my entire blog, is to provide general guidelines, code snippets and sample output. I expect my readers to fill in the missing blanks. Admittedly, not all readers can do this, but I aim high, unapologetically. I rarely spoon-feed users with complete code programs. This would be quite beyond the scope of a typical blog post, or the amount of time that I can spend pro-bono. Remember that this blog has 400 articles, so if I had to spend a full day on each one, this would translate to almost two full work-<b>years</b>! </p>
<p>I have now added some extra code and explanations to the main text, which should be more than enough for most Matlab developers. If it&#8217;s still not enough for you, then consider asking a professional Matlab developer to assist you.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Peter		</title>
		<link>https://undocumentedmatlab.com/articles/auto-completion-widget#comment-425582</link>

		<dc:creator><![CDATA[Peter]]></dc:creator>
		<pubDate>Sat, 12 May 2018 23:14:22 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=5763#comment-425582</guid>

					<description><![CDATA[This looks great but as others have pointed out, the example is incomplete. Could you provide an actual working code as the code snippets you provide does not work by them self? 

Thanks.]]></description>
			<content:encoded><![CDATA[<p>This looks great but as others have pointed out, the example is incomplete. Could you provide an actual working code as the code snippets you provide does not work by them self? </p>
<p>Thanks.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Yair Altman		</title>
		<link>https://undocumentedmatlab.com/articles/auto-completion-widget#comment-421561</link>

		<dc:creator><![CDATA[Yair Altman]]></dc:creator>
		<pubDate>Tue, 27 Mar 2018 17:55:40 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=5763#comment-421561</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/auto-completion-widget#comment-421560&quot;&gt;Eric Alexander&lt;/a&gt;.

@Eric - read &lt;a href=&quot;http://undocumentedmatlab.com/blog/auto-completion-widget#comment-351076&quot; rel=&quot;nofollow&quot;&gt;my answer above&lt;/a&gt;]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/auto-completion-widget#comment-421560">Eric Alexander</a>.</p>
<p>@Eric &#8211; read <a href="http://undocumentedmatlab.com/blog/auto-completion-widget#comment-351076" rel="nofollow">my answer above</a></p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Eric Alexander		</title>
		<link>https://undocumentedmatlab.com/articles/auto-completion-widget#comment-421560</link>

		<dc:creator><![CDATA[Eric Alexander]]></dc:creator>
		<pubDate>Tue, 27 Mar 2018 17:35:13 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=5763#comment-421560</guid>

					<description><![CDATA[Yair,

I am trying to implement something very similar in a GUI I am making but after creating the Combo Box and running your above code, I am getting an error at the line: 

&lt;pre lang=&quot;matlab&quot;&gt;assetClassIdx = getappdata(handles.cbAssetClass, &#039;assetClassIdx&#039;);&lt;/pre&gt;

because there is no variable &quot;&lt;code&gt;handles.&lt;/code&gt;&quot; What does this variable need to be?]]></description>
			<content:encoded><![CDATA[<p>Yair,</p>
<p>I am trying to implement something very similar in a GUI I am making but after creating the Combo Box and running your above code, I am getting an error at the line: </p>
<pre lang="matlab">assetClassIdx = getappdata(handles.cbAssetClass, 'assetClassIdx');</pre>
<p>because there is no variable &#8220;<code>handles.</code>&#8221; What does this variable need to be?</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Johan		</title>
		<link>https://undocumentedmatlab.com/articles/auto-completion-widget#comment-401969</link>

		<dc:creator><![CDATA[Johan]]></dc:creator>
		<pubDate>Sun, 05 Mar 2017 00:26:12 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=5763#comment-401969</guid>

					<description><![CDATA[Hello Yair,

Im having a problem with getting a keypress callback on R2015b for the simpe autocompletewidget:

&lt;pre lang=&quot;matlab&quot;&gt;
strs = {&#039;This&#039;,&#039;is&#039;,&#039;test1&#039;,&#039;test2&#039;};
strList = java.util.ArrayList;
for idx = 1 : length(strs),  strList.add(strs{idx});  end
jPanelObj = com.mathworks.widgets.AutoCompletionList(strList,&#039;&#039;);
javacomponent(jPanelObj.getComponent, [10,10,200,100], gcf);
set(handle(jPanelObj.getComponent,&#039;callbackproperties&#039;), &#039;KeyTypedCallback&#039;, @myMatlabCallbackFunc);
&lt;/pre&gt;

I would like to have this callback to register a &#039;enter&#039; keystroke signifying a completed selection.

Any help would be greatly appreciated!]]></description>
			<content:encoded><![CDATA[<p>Hello Yair,</p>
<p>Im having a problem with getting a keypress callback on R2015b for the simpe autocompletewidget:</p>
<pre lang="matlab">
strs = {'This','is','test1','test2'};
strList = java.util.ArrayList;
for idx = 1 : length(strs),  strList.add(strs{idx});  end
jPanelObj = com.mathworks.widgets.AutoCompletionList(strList,'');
javacomponent(jPanelObj.getComponent, [10,10,200,100], gcf);
set(handle(jPanelObj.getComponent,'callbackproperties'), 'KeyTypedCallback', @myMatlabCallbackFunc);
</pre>
<p>I would like to have this callback to register a &#8216;enter&#8217; keystroke signifying a completed selection.</p>
<p>Any help would be greatly appreciated!</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Yair Altman		</title>
		<link>https://undocumentedmatlab.com/articles/auto-completion-widget#comment-397448</link>

		<dc:creator><![CDATA[Yair Altman]]></dc:creator>
		<pubDate>Fri, 23 Dec 2016 10:57:47 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=5763#comment-397448</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/auto-completion-widget#comment-397242&quot;&gt;Stefano&lt;/a&gt;.

@Stefano - answering this is beyond the time that I can spend on a blog comment. You&#039;re invited to email me (altmany at gmail) for a short consultancy on your specific program.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/auto-completion-widget#comment-397242">Stefano</a>.</p>
<p>@Stefano &#8211; answering this is beyond the time that I can spend on a blog comment. You&#8217;re invited to email me (altmany at gmail) for a short consultancy on your specific program.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Stefano		</title>
		<link>https://undocumentedmatlab.com/articles/auto-completion-widget#comment-397242</link>

		<dc:creator><![CDATA[Stefano]]></dc:creator>
		<pubDate>Thu, 22 Dec 2016 09:47:19 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=5763#comment-397242</guid>

					<description><![CDATA[Hi Yair,

I&#039;m trying to implement your Autocomplete widget in my GUI (more simple than yours). 
I&#039;ve decided to split the code to better understand it, but i have two problems:

1) I can&#039;t select the word from the combobox dropdown panel or by typing in the search text-box

How can i do that?  How can i get the selected word to use it?
I&#039;ve tried with jAssetChooser.getSearchText or jCombo.getSelectedItem but it didn&#039;t work.
Must i use the setappdata comand?

2) If the word doesn&#039;t match with my the list i get this Java error: 
&lt;pre lang=&quot;matlab&quot;&gt;
Error using provaaa/updateSearch (line 94)
Java exception occurred:
java.lang.NullPointerException
	at javax.swing.DefaultComboBoxModel.(Unknown Source)
&lt;/pre&gt;

I&#039;m using matlab 2016a.

This is my example code:
&lt;i&gt;[*** very large code section removed ***]&lt;/i&gt;

Thanks in advance.
Stefano]]></description>
			<content:encoded><![CDATA[<p>Hi Yair,</p>
<p>I&#8217;m trying to implement your Autocomplete widget in my GUI (more simple than yours).<br />
I&#8217;ve decided to split the code to better understand it, but i have two problems:</p>
<p>1) I can&#8217;t select the word from the combobox dropdown panel or by typing in the search text-box</p>
<p>How can i do that?  How can i get the selected word to use it?<br />
I&#8217;ve tried with jAssetChooser.getSearchText or jCombo.getSelectedItem but it didn&#8217;t work.<br />
Must i use the setappdata comand?</p>
<p>2) If the word doesn&#8217;t match with my the list i get this Java error: </p>
<pre lang="matlab">
Error using provaaa/updateSearch (line 94)
Java exception occurred:
java.lang.NullPointerException
	at javax.swing.DefaultComboBoxModel.(Unknown Source)
</pre>
<p>I&#8217;m using matlab 2016a.</p>
<p>This is my example code:<br />
<i>[*** very large code section removed ***]</i></p>
<p>Thanks in advance.<br />
Stefano</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
