<?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: Adding a context-menu to a uitree	</title>
	<atom:link href="https://undocumentedmatlab.com/articles/adding-context-menu-to-uitree/feed" rel="self" type="application/rss+xml" />
	<link>https://undocumentedmatlab.com/articles/adding-context-menu-to-uitree?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=adding-context-menu-to-uitree</link>
	<description>Professional Matlab consulting, development and training</description>
	<lastBuildDate>Sat, 16 Jan 2021 23:20:46 +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/adding-context-menu-to-uitree#comment-509759</link>

		<dc:creator><![CDATA[Yair Altman]]></dc:creator>
		<pubDate>Sat, 16 Jan 2021 23:20:46 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=109#comment-509759</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/adding-context-menu-to-uitree#comment-509747&quot;&gt;Yerlan&lt;/a&gt;.

Yerlan - either use &lt;code&gt;menuItem1.setEnabled(0)&lt;/code&gt; or &lt;code&gt;set(menuItem1,&#039;Enabled&#039;,0)&lt;/code&gt;]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/adding-context-menu-to-uitree#comment-509747">Yerlan</a>.</p>
<p>Yerlan &#8211; either use <code>menuItem1.setEnabled(0)</code> or <code>set(menuItem1,'Enabled',0)</code></p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Yerlan		</title>
		<link>https://undocumentedmatlab.com/articles/adding-context-menu-to-uitree#comment-509747</link>

		<dc:creator><![CDATA[Yerlan]]></dc:creator>
		<pubDate>Fri, 15 Jan 2021 15:41:54 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=109#comment-509747</guid>

					<description><![CDATA[Hello Mr. Altman,

how can I disable menu items in the context menu?

E.g. when I am trying to do this:
&lt;pre lang=&quot;matlab&quot;&gt;
menuItems = jmenu.getSubElements;
menuItem1 = menuItems(1); 
set(menuItem1,&#039;setEnabled&#039;,0);
&lt;/pre&gt;
I get an error: &quot;The name &#039;setEnabled&#039; is not an accessible property for an instance of class &#039;javax.swing.JMenuItem&#039;.&quot;

Thank you.

Best regards,
Yerlan]]></description>
			<content:encoded><![CDATA[<p>Hello Mr. Altman,</p>
<p>how can I disable menu items in the context menu?</p>
<p>E.g. when I am trying to do this:</p>
<pre lang="matlab">
menuItems = jmenu.getSubElements;
menuItem1 = menuItems(1); 
set(menuItem1,'setEnabled',0);
</pre>
<p>I get an error: &#8220;The name &#8216;setEnabled&#8217; is not an accessible property for an instance of class &#8216;javax.swing.JMenuItem&#8217;.&#8221;</p>
<p>Thank you.</p>
<p>Best regards,<br />
Yerlan</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Yair Altman		</title>
		<link>https://undocumentedmatlab.com/articles/adding-context-menu-to-uitree#comment-439384</link>

		<dc:creator><![CDATA[Yair Altman]]></dc:creator>
		<pubDate>Thu, 06 Sep 2018 07:09:53 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=109#comment-439384</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/adding-context-menu-to-uitree#comment-439375&quot;&gt;Hironori Tokuno&lt;/a&gt;.

@Hironori - callback functions run asynchronously, not synchronously, so they do not return any value. You can save the results in some persistent place (like a global variable or the figure&#039;s UserData property) and in your main program you can later access this data. You can read about Matlab callbacks and how to use them in Matlab&#039;s standard documentation.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/adding-context-menu-to-uitree#comment-439375">Hironori Tokuno</a>.</p>
<p>@Hironori &#8211; callback functions run asynchronously, not synchronously, so they do not return any value. You can save the results in some persistent place (like a global variable or the figure&#8217;s UserData property) and in your main program you can later access this data. You can read about Matlab callbacks and how to use them in Matlab&#8217;s standard documentation.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Hironori Tokuno		</title>
		<link>https://undocumentedmatlab.com/articles/adding-context-menu-to-uitree#comment-439375</link>

		<dc:creator><![CDATA[Hironori Tokuno]]></dc:creator>
		<pubDate>Thu, 06 Sep 2018 06:33:08 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=109#comment-439375</guid>

					<description><![CDATA[Hello Mr. Altman

Thank you for this variable informations

How could I get the Output variable from the function &quot;myFunc2&quot; using the command
&quot;&lt;code&gt;set(menuItem2,&#039;ActionPerformedCallback&#039;,{@myFunc2,data1,data2});&lt;/code&gt;&quot; at this case?
&lt;pre lang=&quot;matlab&quot;&gt;
% -- Example
function output = myFunc2(hObject, eventData, myData1, myData2)
output = myData1 + myData2;
end
&lt;/pre&gt;
I need to get the variable &quot;output&quot; into my main function after the mouse right button action was performed. 

Will you please advise me for this?

Thanks in advance
Best regards
Hiro Tokuno]]></description>
			<content:encoded><![CDATA[<p>Hello Mr. Altman</p>
<p>Thank you for this variable informations</p>
<p>How could I get the Output variable from the function &#8220;myFunc2&#8221; using the command<br />
&#8220;<code>set(menuItem2,'ActionPerformedCallback',{@myFunc2,data1,data2});</code>&#8221; at this case?</p>
<pre lang="matlab">
% -- Example
function output = myFunc2(hObject, eventData, myData1, myData2)
output = myData1 + myData2;
end
</pre>
<p>I need to get the variable &#8220;output&#8221; into my main function after the mouse right button action was performed. </p>
<p>Will you please advise me for this?</p>
<p>Thanks in advance<br />
Best regards<br />
Hiro Tokuno</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Yair Altman		</title>
		<link>https://undocumentedmatlab.com/articles/adding-context-menu-to-uitree#comment-418946</link>

		<dc:creator><![CDATA[Yair Altman]]></dc:creator>
		<pubDate>Tue, 06 Feb 2018 09:20:10 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=109#comment-418946</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/adding-context-menu-to-uitree#comment-418938&quot;&gt;Ian Alan&lt;/a&gt;.

@Ian - try to call the Java object&#039;s &lt;code&gt;repaint()&lt;/code&gt; method (function), after adding it to the panel (presumably using a call to &lt;i&gt;&lt;b&gt;javacomponent&lt;/b&gt;&lt;/i&gt;)]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/adding-context-menu-to-uitree#comment-418938">Ian Alan</a>.</p>
<p>@Ian &#8211; try to call the Java object&#8217;s <code>repaint()</code> method (function), after adding it to the panel (presumably using a call to <i><b>javacomponent</b></i>)</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Ian Alan		</title>
		<link>https://undocumentedmatlab.com/articles/adding-context-menu-to-uitree#comment-418938</link>

		<dc:creator><![CDATA[Ian Alan]]></dc:creator>
		<pubDate>Tue, 06 Feb 2018 04:29:45 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=109#comment-418938</guid>

					<description><![CDATA[Yair,

I am trying to create a uitree one a resizable panel created with your uisplitpane() function.

The tree won&#039;t show up at all in the figure until I drag the divider around with the mouse to resize the panes, and then it shows up like it should. Do you have any suggestions on how I could fix this?

I am using MATLAB 2011a, if it matters.]]></description>
			<content:encoded><![CDATA[<p>Yair,</p>
<p>I am trying to create a uitree one a resizable panel created with your uisplitpane() function.</p>
<p>The tree won&#8217;t show up at all in the figure until I drag the divider around with the mouse to resize the panes, and then it shows up like it should. Do you have any suggestions on how I could fix this?</p>
<p>I am using MATLAB 2011a, if it matters.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Yair Altman		</title>
		<link>https://undocumentedmatlab.com/articles/adding-context-menu-to-uitree#comment-356475</link>

		<dc:creator><![CDATA[Yair Altman]]></dc:creator>
		<pubDate>Sat, 05 Sep 2015 17:27:27 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=109#comment-356475</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/adding-context-menu-to-uitree#comment-356430&quot;&gt;Deepak Bhatia&lt;/a&gt;.

http://undocumentedmatlab.com/blog/matlab-callbacks-for-java-events-in-r2014a]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/adding-context-menu-to-uitree#comment-356430">Deepak Bhatia</a>.</p>
<p><a href="http://undocumentedmatlab.com/blog/matlab-callbacks-for-java-events-in-r2014a" rel="ugc">http://undocumentedmatlab.com/blog/matlab-callbacks-for-java-events-in-r2014a</a></p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Deepak Bhatia		</title>
		<link>https://undocumentedmatlab.com/articles/adding-context-menu-to-uitree#comment-356430</link>

		<dc:creator><![CDATA[Deepak Bhatia]]></dc:creator>
		<pubDate>Fri, 04 Sep 2015 15:45:56 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=109#comment-356430</guid>

					<description><![CDATA[Hi,
I am also trying to set the MousePressedCallback of jtree where jtree is com.mathworks.hg.peer.utils.UIMJTree. 
I dont know Java at all but I am modifying an exisiting code to work with ML2015. I get the error
&lt;pre lang=&#039;matlab&#039;&gt;The name &#039;MousePressedCallback&#039; is not an accessible property for an instance of class &#039;com.mathworks.hg.peer.utils.UIMJTree&lt;/pre&gt;
Any Ideas how I can do this: i noticed that the jtree.getTree is also not present. 
I just have the following. 
jtree.getTreeSelectionListeners
Help will be appreciated]]></description>
			<content:encoded><![CDATA[<p>Hi,<br />
I am also trying to set the MousePressedCallback of jtree where jtree is com.mathworks.hg.peer.utils.UIMJTree.<br />
I dont know Java at all but I am modifying an exisiting code to work with ML2015. I get the error</p>
<pre lang='matlab'>The name 'MousePressedCallback' is not an accessible property for an instance of class 'com.mathworks.hg.peer.utils.UIMJTree</pre>
<p>Any Ideas how I can do this: i noticed that the jtree.getTree is also not present.<br />
I just have the following.<br />
jtree.getTreeSelectionListeners<br />
Help will be appreciated</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Ramiro Massol		</title>
		<link>https://undocumentedmatlab.com/articles/adding-context-menu-to-uitree#comment-320625</link>

		<dc:creator><![CDATA[Ramiro Massol]]></dc:creator>
		<pubDate>Thu, 27 Mar 2014 18:27:59 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=109#comment-320625</guid>

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

I&#039;m not sure it&#039;s an application bug. Before subimage I actually target both the figure and the axes by using &quot;figure(handle); axes(axeshandle)&quot;. I have not used gcf or gca at all. Thanks anyway,
best]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/adding-context-menu-to-uitree#comment-320597">Yair Altman</a>.</p>
<p>I&#8217;m not sure it&#8217;s an application bug. Before subimage I actually target both the figure and the axes by using &#8220;figure(handle); axes(axeshandle)&#8221;. I have not used gcf or gca at all. Thanks anyway,<br />
best</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Yair Altman		</title>
		<link>https://undocumentedmatlab.com/articles/adding-context-menu-to-uitree#comment-320597</link>

		<dc:creator><![CDATA[Yair Altman]]></dc:creator>
		<pubDate>Thu, 27 Mar 2014 14:32:38 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=109#comment-320597</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/adding-context-menu-to-uitree#comment-320592&quot;&gt;Ramiro Massol&lt;/a&gt;.

It sounds like you have updated the GUI using &lt;i&gt;&lt;b&gt;gcf&lt;/b&gt;&lt;/i&gt;, &lt;i&gt;&lt;b&gt;gca&lt;/b&gt;&lt;/i&gt;, or direct plotting (via &lt;i&gt;&lt;b&gt;plot&lt;/b&gt;&lt;/i&gt; or &lt;i&gt;&lt;b&gt;image&lt;/b&gt;&lt;/i&gt;), without directly specifying the target container handle. Since you use hidden handles in your code, the function targets whatever GUI container that has a &lt;i&gt;non-hidden&lt;/i&gt; handle was last made active. By setting the &lt;b&gt;ShowHiddenProperties&lt;/b&gt; of the root you simply made all handles visible, but this merely hides the root cause of your problem, which is the fact that you have not directly specified the target handle. Once you do that, there will no longer be a need for setting &lt;b&gt;ShowHiddenProperties&lt;/b&gt;.

In short, it&#039;s an application bug, not a Matlab bug.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/adding-context-menu-to-uitree#comment-320592">Ramiro Massol</a>.</p>
<p>It sounds like you have updated the GUI using <i><b>gcf</b></i>, <i><b>gca</b></i>, or direct plotting (via <i><b>plot</b></i> or <i><b>image</b></i>), without directly specifying the target container handle. Since you use hidden handles in your code, the function targets whatever GUI container that has a <i>non-hidden</i> handle was last made active. By setting the <b>ShowHiddenProperties</b> of the root you simply made all handles visible, but this merely hides the root cause of your problem, which is the fact that you have not directly specified the target handle. Once you do that, there will no longer be a need for setting <b>ShowHiddenProperties</b>.</p>
<p>In short, it&#8217;s an application bug, not a Matlab bug.</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
