<?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: Customizing help popup contents	</title>
	<atom:link href="https://undocumentedmatlab.com/articles/customizing-help-popup-contents/feed" rel="self" type="application/rss+xml" />
	<link>https://undocumentedmatlab.com/articles/customizing-help-popup-contents?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=customizing-help-popup-contents</link>
	<description>Professional Matlab consulting, development and training</description>
	<lastBuildDate>Fri, 14 Aug 2020 13:13:45 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.7.2</generator>
	<item>
		<title>
		By: Yair Altman		</title>
		<link>https://undocumentedmatlab.com/articles/customizing-help-popup-contents#comment-508826</link>

		<dc:creator><![CDATA[Yair Altman]]></dc:creator>
		<pubDate>Fri, 14 Aug 2020 13:13:45 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=819#comment-508826</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/customizing-help-popup-contents#comment-508813&quot;&gt;Peter&lt;/a&gt;.

@Peter - the graphics system might not be fully initialized by the time that the startup script is being executed by the Matlab engine. I suggest placing the relevant code in a small function and in startup.m simply start a single-shot timer with a StartDelay of several seconds, that will run the new function in its TimerFcn callback.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/customizing-help-popup-contents#comment-508813">Peter</a>.</p>
<p>@Peter &#8211; the graphics system might not be fully initialized by the time that the startup script is being executed by the Matlab engine. I suggest placing the relevant code in a small function and in startup.m simply start a single-shot timer with a StartDelay of several seconds, that will run the new function in its TimerFcn callback.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Peter		</title>
		<link>https://undocumentedmatlab.com/articles/customizing-help-popup-contents#comment-508813</link>

		<dc:creator><![CDATA[Peter]]></dc:creator>
		<pubDate>Tue, 11 Aug 2020 19:14:59 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=819#comment-508813</guid>

					<description><![CDATA[I have a problem with putting this into the startup.m to be executed at the beginning of the MATLAB session.
&lt;pre lang=&quot;matlab&quot;&gt;
jDesktop = com.mathworks.mde.desk.MLDesktop.getInstance;
try
    cmdWin = jDesktop.getClient(&#039;Command Window&#039;);
    jTextArea = cmdWin.getComponent(0).getViewport.getComponent(0);
catch
    commandwindow;
    jTextArea = jDesktop.getMainFrame.getFocusOwner;
end
jClassName = &#039;com.mathworks.mlwidgets.help.HelpPopup&#039;;
jPosition = java.awt.Rectangle(0, 0, 400, 300);
helpTopic = &#039;surf&#039;;
% Variant 1:
javaMethodEDT(&#039;showHelp&#039;, jClassName, jTextArea, [], jPosition, helpTopic);
% Variant 2:
%jniSig = &#039;showHelp(Ljavax.swing.JComponent;Lcom.mathworks.mwswing.binding.KeyStrokeList;Ljava.awt.Rectangle;Ljava.lang.String;)&#039;;
%awtinvoke(jClassName,jniSig,jTextArea,[],jPosition,helpTopic);
&lt;/pre&gt;
My startup script uses similar code that opens and closes a dummy popup with custom window size that would be applied for subsequent F1-popups.
In R2018a and R2020b Prerelease the above example works well as standalone code. Nevertheless, when used in startup.m it does not create a popup during the startup (and for variant 1 it also results in “java.lang.IllegalArgumentException: &#039;parent&#039; cannot be null” exception). I remember that in some earlier releases a similar solution used to work (pause(1) or drawnow were helpful in case of errors), but now I cannot find any fix. Maybe you would know if it is still possible to open a popup with the desired size during MATLAB startup.]]></description>
			<content:encoded><![CDATA[<p>I have a problem with putting this into the startup.m to be executed at the beginning of the MATLAB session.</p>
<pre lang="matlab">
jDesktop = com.mathworks.mde.desk.MLDesktop.getInstance;
try
    cmdWin = jDesktop.getClient('Command Window');
    jTextArea = cmdWin.getComponent(0).getViewport.getComponent(0);
catch
    commandwindow;
    jTextArea = jDesktop.getMainFrame.getFocusOwner;
end
jClassName = 'com.mathworks.mlwidgets.help.HelpPopup';
jPosition = java.awt.Rectangle(0, 0, 400, 300);
helpTopic = 'surf';
% Variant 1:
javaMethodEDT('showHelp', jClassName, jTextArea, [], jPosition, helpTopic);
% Variant 2:
%jniSig = 'showHelp(Ljavax.swing.JComponent;Lcom.mathworks.mwswing.binding.KeyStrokeList;Ljava.awt.Rectangle;Ljava.lang.String;)';
%awtinvoke(jClassName,jniSig,jTextArea,[],jPosition,helpTopic);
</pre>
<p>My startup script uses similar code that opens and closes a dummy popup with custom window size that would be applied for subsequent F1-popups.<br />
In R2018a and R2020b Prerelease the above example works well as standalone code. Nevertheless, when used in startup.m it does not create a popup during the startup (and for variant 1 it also results in “java.lang.IllegalArgumentException: &#8216;parent&#8217; cannot be null” exception). I remember that in some earlier releases a similar solution used to work (pause(1) or drawnow were helpful in case of errors), but now I cannot find any fix. Maybe you would know if it is still possible to open a popup with the desired size during MATLAB startup.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Yair Altman		</title>
		<link>https://undocumentedmatlab.com/articles/customizing-help-popup-contents#comment-487723</link>

		<dc:creator><![CDATA[Yair Altman]]></dc:creator>
		<pubDate>Fri, 26 Jul 2019 10:12:12 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=819#comment-487723</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/customizing-help-popup-contents#comment-487585&quot;&gt;Peng Liu&lt;/a&gt;.

@Peng - the code above was relevant as of the time I wrote the article, 10 years ago (2009). In recent Matlab releases the code needs to be modified a bit:
&lt;pre lang=&quot;matlab&quot;&gt;
browser = jPopup.getContentPane.getComponent(1).getComponent(1).getComponent.getBrowser;
browser.loadHTML(html)  % to display a string containing HTML code
browser.loadURL(url)    % to display an online webpage (e.g. &#039;google.com&#039;)
&lt;/pre&gt;]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/customizing-help-popup-contents#comment-487585">Peng Liu</a>.</p>
<p>@Peng &#8211; the code above was relevant as of the time I wrote the article, 10 years ago (2009). In recent Matlab releases the code needs to be modified a bit:</p>
<pre lang="matlab">
browser = jPopup.getContentPane.getComponent(1).getComponent(1).getComponent.getBrowser;
browser.loadHTML(html)  % to display a string containing HTML code
browser.loadURL(url)    % to display an online webpage (e.g. 'google.com')
</pre>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Peng Liu		</title>
		<link>https://undocumentedmatlab.com/articles/customizing-help-popup-contents#comment-487585</link>

		<dc:creator><![CDATA[Peng Liu]]></dc:creator>
		<pubDate>Thu, 25 Jul 2019 08:00:41 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=819#comment-487585</guid>

					<description><![CDATA[Hi Yair,

When I try to use html in help popup, I was told there is no setHtmlText of browser. So I ask myself is there any update in matlab 2017b. But I tried getComponent with other indices which doesn&#039;t work. Maybe you would have a clue. Thanks a lot.

&lt;pre lang=&quot;matlab&quot;&gt;
browser = jPopup.getContentPane.getComponent(1).getComponent(0);
browser.setHtmlText(html);
&lt;/pre&gt;]]></description>
			<content:encoded><![CDATA[<p>Hi Yair,</p>
<p>When I try to use html in help popup, I was told there is no setHtmlText of browser. So I ask myself is there any update in matlab 2017b. But I tried getComponent with other indices which doesn&#8217;t work. Maybe you would have a clue. Thanks a lot.</p>
<pre lang="matlab">
browser = jPopup.getContentPane.getComponent(1).getComponent(0);
browser.setHtmlText(html);
</pre>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Nathan		</title>
		<link>https://undocumentedmatlab.com/articles/customizing-help-popup-contents#comment-6512</link>

		<dc:creator><![CDATA[Nathan]]></dc:creator>
		<pubDate>Thu, 28 Jan 2010 00:08:48 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=819#comment-6512</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/customizing-help-popup-contents#comment-6510&quot;&gt;Yair Altman&lt;/a&gt;.

I am not using GUIDE (as implied by &quot;coding by hand&quot;), but your getClient() method worked for me. Thanks for the quick response and your help. This website is very insightful.

-Nathan]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/customizing-help-popup-contents#comment-6510">Yair Altman</a>.</p>
<p>I am not using GUIDE (as implied by &#8220;coding by hand&#8221;), but your getClient() method worked for me. Thanks for the quick response and your help. This website is very insightful.</p>
<p>-Nathan</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Yair Altman		</title>
		<link>https://undocumentedmatlab.com/articles/customizing-help-popup-contents#comment-6510</link>

		<dc:creator><![CDATA[Yair Altman]]></dc:creator>
		<pubDate>Wed, 27 Jan 2010 23:40:57 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=819#comment-6510</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/customizing-help-popup-contents#comment-6509&quot;&gt;Nathan&lt;/a&gt;.

@Nathan - I assume you haven&#039;t placed this in your GUIDE-generated _OpeningFcn(), as explained &lt;a target=&quot;_blank&quot; href=&quot;http://undocumentedmatlab.com/blog/findjobj-find-underlying-java-object/comment-page-1/#comment-6079&quot; rel=&quot;nofollow&quot;&gt;elsewhere&lt;/a&gt;. Another cause of this might be that when you run the code, jTextArea is still unavailable by the time the &lt;b&gt;&lt;i&gt;javaMethodEDT&lt;/i&gt;&lt;/b&gt; is called. In step-by-step debugging this is not an issue, since there is plenty of time for jTextArea to be set. It is also possible that there is no FocusOwner in the Desktop (unlike the case of step-by-step debugging) - this can be forced using the &lt;b&gt;&lt;i&gt;commandwindow&lt;/i&gt;&lt;/b&gt; function. As a final alternative, try using the getClient() approach to getting the Command-window TextArea, as I explained in my recent &lt;a target=&quot;_blank&quot; href=&quot;http://undocumentedmatlab.com/blog/setprompt-setting-matlab-desktop-prompt/&quot; rel=&quot;nofollow&quot;&gt;&lt;b&gt;&lt;i&gt;setPrompt&lt;/i&gt;&lt;/b&gt; article&lt;/a&gt;:

&lt;pre lang=&quot;matlab&quot;&gt;
jDesktop = com.mathworks.mde.desk.MLDesktop.getInstance;
try
  cmdWin = jDesktop.getClient(&#039;Command Window&#039;);
  jTextArea = cmdWin.getComponent(0).getViewport.getComponent(0);
catch
  commandwindow;
  jTextArea = jDesktop.getMainFrame.getFocusOwner;
end
&lt;/pre&gt;]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/customizing-help-popup-contents#comment-6509">Nathan</a>.</p>
<p>@Nathan &#8211; I assume you haven&#8217;t placed this in your GUIDE-generated _OpeningFcn(), as explained <a target="_blank" href="http://undocumentedmatlab.com/blog/findjobj-find-underlying-java-object/comment-page-1/#comment-6079" rel="nofollow">elsewhere</a>. Another cause of this might be that when you run the code, jTextArea is still unavailable by the time the <b><i>javaMethodEDT</i></b> is called. In step-by-step debugging this is not an issue, since there is plenty of time for jTextArea to be set. It is also possible that there is no FocusOwner in the Desktop (unlike the case of step-by-step debugging) &#8211; this can be forced using the <b><i>commandwindow</i></b> function. As a final alternative, try using the getClient() approach to getting the Command-window TextArea, as I explained in my recent <a target="_blank" href="http://undocumentedmatlab.com/blog/setprompt-setting-matlab-desktop-prompt/" rel="nofollow"><b><i>setPrompt</i></b> article</a>:</p>
<pre lang="matlab">
jDesktop = com.mathworks.mde.desk.MLDesktop.getInstance;
try
  cmdWin = jDesktop.getClient('Command Window');
  jTextArea = cmdWin.getComponent(0).getViewport.getComponent(0);
catch
  commandwindow;
  jTextArea = jDesktop.getMainFrame.getFocusOwner;
end
</pre>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Nathan		</title>
		<link>https://undocumentedmatlab.com/articles/customizing-help-popup-contents#comment-6509</link>

		<dc:creator><![CDATA[Nathan]]></dc:creator>
		<pubDate>Wed, 27 Jan 2010 23:18:51 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=819#comment-6509</guid>

					<description><![CDATA[I&#039;m having troubles using this in a GUI that I&#039;m coding by hand.
As a &quot;help&quot; pushbutton callback, I have the following code:
&lt;pre lang=&quot;matlab&quot;&gt;
function [] = pb_call5(varargin)
  jDesktop = com.mathworks.mde.desk.MLDesktop.getInstance;
  jClassName = &#039;com.mathworks.mlwidgets.help.HelpPopup&#039;;
  jPosition = java.awt.Rectangle(200,200,650,600);
  jTextArea = jDesktop.getMainFrame.getFocusOwner;
  helpTopic = &#039;LiqVapGui&#039;;
  javaMethodEDT(&#039;showHelp&#039;,jClassName,jTextArea,[],jPosition,helpTopic);
end
&lt;/pre&gt;

However, I am receiving an error stating that
&quot;??? Error using ==&#062; javaMethodEDT
Java exception occurred:
java.lang.IllegalArgumentException: &#039;parent&#039; cannot be null&quot;

When stepping through the debugger, I find that jTextArea is empty. However, if I re-type that line while in debug mode, it works just fine. Do you know any way that I can fix this problem?

-Nathan]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m having troubles using this in a GUI that I&#8217;m coding by hand.<br />
As a &#8220;help&#8221; pushbutton callback, I have the following code:</p>
<pre lang="matlab">
function [] = pb_call5(varargin)
  jDesktop = com.mathworks.mde.desk.MLDesktop.getInstance;
  jClassName = 'com.mathworks.mlwidgets.help.HelpPopup';
  jPosition = java.awt.Rectangle(200,200,650,600);
  jTextArea = jDesktop.getMainFrame.getFocusOwner;
  helpTopic = 'LiqVapGui';
  javaMethodEDT('showHelp',jClassName,jTextArea,[],jPosition,helpTopic);
end
</pre>
<p>However, I am receiving an error stating that<br />
&#8220;??? Error using ==&gt; javaMethodEDT<br />
Java exception occurred:<br />
java.lang.IllegalArgumentException: &#8216;parent&#8217; cannot be null&#8221;</p>
<p>When stepping through the debugger, I find that jTextArea is empty. However, if I re-type that line while in debug mode, it works just fine. Do you know any way that I can fix this problem?</p>
<p>-Nathan</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Yair Altman		</title>
		<link>https://undocumentedmatlab.com/articles/customizing-help-popup-contents#comment-4832</link>

		<dc:creator><![CDATA[Yair Altman]]></dc:creator>
		<pubDate>Tue, 01 Dec 2009 22:13:13 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=819#comment-4832</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/customizing-help-popup-contents#comment-4820&quot;&gt;Dani&lt;/a&gt;.

1. This was due to a change in the way Matlab implemented the internal browser component in R2009. This only has an effect on highlighted words  of a &lt;b&gt;&lt;i&gt;doc&lt;/i&gt;&lt;/b&gt; page, not any other &lt;b&gt;&lt;i&gt;popupPanel&lt;/i&gt;&lt;/b&gt; functionality. Anyway, I have uploaded a fixed version which should be available for download by tomorrow (depending on MathWorks workload...).

2. I don&#039;t know a way around using the desktop or m-editor reference.

- Yair]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/customizing-help-popup-contents#comment-4820">Dani</a>.</p>
<p>1. This was due to a change in the way Matlab implemented the internal browser component in R2009. This only has an effect on highlighted words  of a <b><i>doc</i></b> page, not any other <b><i>popupPanel</i></b> functionality. Anyway, I have uploaded a fixed version which should be available for download by tomorrow (depending on MathWorks workload&#8230;).</p>
<p>2. I don&#8217;t know a way around using the desktop or m-editor reference.</p>
<p>&#8211; Yair</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Dani		</title>
		<link>https://undocumentedmatlab.com/articles/customizing-help-popup-contents#comment-4820</link>

		<dc:creator><![CDATA[Dani]]></dc:creator>
		<pubDate>Tue, 01 Dec 2009 15:45:34 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=819#comment-4820</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/context-sensitive-help#comment-4774&quot;&gt;Yair Altman&lt;/a&gt;.

Fantastic - thanks a lot for this!

Two problems:

1. The popupPanel(&#039;surf&#039;) call leads to the following error on my machine:
 &lt;pre lang=&quot;matlab&quot;&gt;
??? popupPanel: No appropriate method, property, or field 
getHTMLRenderer for class com.mathworks.mlwidgets.html.HTMLRenderer

Error in ==&gt; popupPanel at 127
        contents = browser.getHTMLRenderer.getHtmlText;
&lt;/pre&gt;
Works as expected for all the other ways of calling it.

2. In compiled mode the Matlab desktop is not accessible. So the following lines cause problems:
&lt;pre lang=&quot;matlab&quot;&gt;
jDesktop = com.mathworks.mde.desk.MLDesktop.getInstance;
jTextArea = jDesktop.getMainFrame.getFocusOwner;
&lt;/pre&gt;
Is it possible to get around this?

Dani]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/context-sensitive-help#comment-4774">Yair Altman</a>.</p>
<p>Fantastic &#8211; thanks a lot for this!</p>
<p>Two problems:</p>
<p>1. The popupPanel(&#8216;surf&#8217;) call leads to the following error on my machine:</p>
<pre lang="matlab">
??? popupPanel: No appropriate method, property, or field 
getHTMLRenderer for class com.mathworks.mlwidgets.html.HTMLRenderer

Error in ==> popupPanel at 127
        contents = browser.getHTMLRenderer.getHtmlText;
</pre>
<p>Works as expected for all the other ways of calling it.</p>
<p>2. In compiled mode the Matlab desktop is not accessible. So the following lines cause problems:</p>
<pre lang="matlab">
jDesktop = com.mathworks.mde.desk.MLDesktop.getInstance;
jTextArea = jDesktop.getMainFrame.getFocusOwner;
</pre>
<p>Is it possible to get around this?</p>
<p>Dani</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
