<?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="http://undocumentedmatlab.com/blog/adding-context-menu-to-uitree/feed/" rel="self" type="application/rss+xml" /><link>http://undocumentedmatlab.com/blog/adding-context-menu-to-uitree/</link> <description>Charting Matlab's unsupported hidden underbelly</description> <lastBuildDate>Thu, 09 Feb 2012 09:23:08 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.1.1</generator> <item><title>By: Customizing uitree &#124; Undocumented Matlab</title><link>http://undocumentedmatlab.com/blog/adding-context-menu-to-uitree/#comment-16119</link> <dc:creator>Customizing uitree &#124; Undocumented Matlab</dc:creator> <pubDate>Wed, 25 Aug 2010 18:02:33 +0000</pubDate> <guid
isPermaLink="false">http://undocumentedmatlab.com/?p=109#comment-16119</guid> <description>[...] As an example customization that uses jtree, consider one of my earliest articles on this website: Adding a context-menu to a uitree. [...]</description> <content:encoded><![CDATA[<p>[...] As an example customization that uses jtree, consider one of my earliest articles on this website: Adding a context-menu to a uitree. [...]</p> ]]></content:encoded> </item> <item><title>By: Yair Altman</title><link>http://undocumentedmatlab.com/blog/adding-context-menu-to-uitree/#comment-12191</link> <dc:creator>Yair Altman</dc:creator> <pubDate>Wed, 07 Jul 2010 23:56:40 +0000</pubDate> <guid
isPermaLink="false">http://undocumentedmatlab.com/?p=109#comment-12191</guid> <description>@Bassam - you forgot the all-important display of the jmenu:
&lt;pre lang=&quot;matlab&quot;&gt;jmenu.show(jComponent, jEventData.getX, jEventData.getY)&lt;/pre&gt;
(jComponent can be real or [])</description> <content:encoded><![CDATA[<p>@Bassam &#8211; you forgot the all-important display of the jmenu:</p><div
class="wp_syntax"><div
class="code"><pre class="matlab" style="font-family:monospace;">jmenu.<span style="">show</span><span style="color: #080;">&#40;</span>jComponent, jEventData.<span style="">getX</span>, jEventData.<span style="">getY</span><span style="color: #080;">&#41;</span></pre></div></div><p>(jComponent can be real or [])</p> ]]></content:encoded> </item> <item><title>By: Bass</title><link>http://undocumentedmatlab.com/blog/adding-context-menu-to-uitree/#comment-12187</link> <dc:creator>Bass</dc:creator> <pubDate>Wed, 07 Jul 2010 23:35:17 +0000</pubDate> <guid
isPermaLink="false">http://undocumentedmatlab.com/?p=109#comment-12187</guid> <description>Awesome article.I was looking for something that would allow me to create a right click context menu for any figure or &lt;i&gt;&lt;b&gt;uitable&lt;/b&gt;&lt;/i&gt;.When I use similar  code (see below for example with a figure) I don&#039;t get any context window displayed (although the mousePressedCallback is called). The same code using the handle of juitable, doesn&#039;t even result in the mousePressCallback being calledAm I doing something wrong or is this&lt;pre lang=&quot;matlab&quot;&gt;
h = figure;
juit = findjobj(h);% Prepare the context menu (note the use of HTML labels)
menuItem1 = javax.swing.JMenuItem(&#039;action #1&#039;);% Set the menu items&#039; callbacks
set(menuItem1,&#039;ActionPerformedCallback&#039;,@myFunc1);% Add all menu items to the context menu (with internal separator)
jmenu = javax.swing.JPopupMenu;
jmenu.add(menuItem1);set(juit, &#039;MousePressedCallback&#039;, {@mousePressedCallback,jmenu});function mousePressedCallback(hTree, eventData, jmenu)
display(&#039;here&#039;)
jmenu.repaint;
end
&lt;/pre&gt;</description> <content:encoded><![CDATA[<p>Awesome article.</p><p>I was looking for something that would allow me to create a right click context menu for any figure or <i><b>uitable</b></i>.</p><p>When I use similar  code (see below for example with a figure) I don&#8217;t get any context window displayed (although the mousePressedCallback is called). The same code using the handle of juitable, doesn&#8217;t even result in the mousePressCallback being called</p><p>Am I doing something wrong or is this</p><div
class="wp_syntax"><div
class="code"><pre class="matlab" style="font-family:monospace;">h = <span style="color: #0000FF;">figure</span>;
juit = findjobj<span style="color: #080;">&#40;</span>h<span style="color: #080;">&#41;</span>;
&nbsp;
<span style="color: #228B22;">% Prepare the context menu (note the use of HTML labels)</span>
menuItem1 = javax.<span style="">swing</span>.<span style="">JMenuItem</span><span style="color: #080;">&#40;</span><span style="color:#A020F0;">'action #1'</span><span style="color: #080;">&#41;</span>;
&nbsp;
<span style="color: #228B22;">% Set the menu items' callbacks</span>
<span style="color: #0000FF;">set</span><span style="color: #080;">&#40;</span>menuItem1,<span style="color:#A020F0;">'ActionPerformedCallback'</span>,@myFunc1<span style="color: #080;">&#41;</span>;
&nbsp;
<span style="color: #228B22;">% Add all menu items to the context menu (with internal separator)</span>
jmenu = javax.<span style="">swing</span>.<span style="">JPopupMenu</span>;
jmenu.<span style="">add</span><span style="color: #080;">&#40;</span>menuItem1<span style="color: #080;">&#41;</span>;
&nbsp;
<span style="color: #0000FF;">set</span><span style="color: #080;">&#40;</span>juit, <span style="color:#A020F0;">'MousePressedCallback'</span>, <span style="color: #080;">&#123;</span>@mousePressedCallback,jmenu<span style="color: #080;">&#125;</span><span style="color: #080;">&#41;</span>;
&nbsp;
<span style="color: #0000FF;">function</span> mousePressedCallback<span style="color: #080;">&#40;</span>hTree, eventData, jmenu<span style="color: #080;">&#41;</span>
   display<span style="color: #080;">&#40;</span><span style="color:#A020F0;">'here'</span><span style="color: #080;">&#41;</span>
   jmenu.<span style="">repaint</span>;
<span style="color: #0000FF;">end</span></pre></div></div>]]></content:encoded> </item> <item><title>By: Setting listbox mouse actions &#124; Undocumented Matlab</title><link>http://undocumentedmatlab.com/blog/adding-context-menu-to-uitree/#comment-2650</link> <dc:creator>Setting listbox mouse actions &#124; Undocumented Matlab</dc:creator> <pubDate>Tue, 15 Sep 2009 13:30:29 +0000</pubDate> <guid
isPermaLink="false">http://undocumentedmatlab.com/?p=109#comment-2650</guid> <description>[...] months ago I explained how to set a context (right-click) menu on a uitree control. I shall now show how to implement a similar dynamic context-menu on a listbox. The code is an [...]</description> <content:encoded><![CDATA[<p>[...] months ago I explained how to set a context (right-click) menu on a uitree control. I shall now show how to implement a similar dynamic context-menu on a listbox. The code is an [...]</p> ]]></content:encoded> </item> <item><title>By: Scott Koch</title><link>http://undocumentedmatlab.com/blog/adding-context-menu-to-uitree/#comment-1214</link> <dc:creator>Scott Koch</dc:creator> <pubDate>Tue, 09 Jun 2009 22:00:55 +0000</pubDate> <guid
isPermaLink="false">http://undocumentedmatlab.com/?p=109#comment-1214</guid> <description>If you have access to the figure handle (stored as User Data for instance) you could also use the click event coordinates to display a GUIDE created context menu:&lt;pre lang=&quot;matlab&quot;&gt;
...
if eventData.isMetaDown
fh = get(hTree,&#039;UserData&#039;);%Get figure handle
cm = findobj(fh,&#039;tag&#039;,&#039;mycontextmenu&#039;);%Get context menu handle.
tpos = get(hTree,&#039;PixelPosition&#039;);
set(cm,&#039;position&#039;,[eventData.getX()+tpos(1) (tpos(4)-eventData.getY)+tpos(2)],&#039;Visible&#039;,&#039;on&#039;);...
&lt;/pre&gt;</description> <content:encoded><![CDATA[<p>If you have access to the figure handle (stored as User Data for instance) you could also use the click event coordinates to display a GUIDE created context menu:</p><div
class="wp_syntax"><div
class="code"><pre class="matlab" style="font-family:monospace;"><span style="color: #F0F;">...</span>
<span style="color: #0000FF;">if</span> eventData.<span style="">isMetaDown</span>
  fh = <span style="color: #0000FF;">get</span><span style="color: #080;">&#40;</span>hTree,<span style="color:#A020F0;">'UserData'</span><span style="color: #080;">&#41;</span>;<span style="color: #228B22;">%Get figure handle</span>
  cm = <span style="color: #0000FF;">findobj</span><span style="color: #080;">&#40;</span>fh,<span style="color:#A020F0;">'tag'</span>,<span style="color:#A020F0;">'mycontextmenu'</span><span style="color: #080;">&#41;</span>;<span style="color: #228B22;">%Get context menu handle.</span>
  tpos = <span style="color: #0000FF;">get</span><span style="color: #080;">&#40;</span>hTree,<span style="color:#A020F0;">'PixelPosition'</span><span style="color: #080;">&#41;</span>;
&nbsp;
  <span style="color: #0000FF;">set</span><span style="color: #080;">&#40;</span>cm,<span style="color:#A020F0;">'position'</span>,<span style="color: #080;">&#91;</span>eventData.<span style="">getX</span><span style="color: #080;">&#40;</span><span style="color: #080;">&#41;</span>+tpos<span style="color: #080;">&#40;</span><span style="color: #33f;">1</span><span style="color: #080;">&#41;</span> <span style="color: #080;">&#40;</span>tpos<span style="color: #080;">&#40;</span><span style="color: #33f;">4</span><span style="color: #080;">&#41;</span>-eventData.<span style="">getY</span><span style="color: #080;">&#41;</span>+tpos<span style="color: #080;">&#40;</span><span style="color: #33f;">2</span><span style="color: #080;">&#41;</span><span style="color: #080;">&#93;</span>,<span style="color:#A020F0;">'Visible'</span>,<span style="color:#A020F0;">'on'</span><span style="color: #080;">&#41;</span>;
&nbsp;
<span style="color: #F0F;">...</span></pre></div></div>]]></content:encoded> </item> <item><title>By: Venky</title><link>http://undocumentedmatlab.com/blog/adding-context-menu-to-uitree/#comment-38</link> <dc:creator>Venky</dc:creator> <pubDate>Wed, 01 Apr 2009 04:27:39 +0000</pubDate> <guid
isPermaLink="false">http://undocumentedmatlab.com/?p=109#comment-38</guid> <description>Yair,
It&#039;s interesting to know that it is possible to add uicontextmenus to uitree.
Your post saved my time.
Thanks a lot</description> <content:encoded><![CDATA[<p>Yair,<br
/> It&#8217;s interesting to know that it is possible to add uicontextmenus to uitree.<br
/> Your post saved my time.<br
/> Thanks a lot</p> ]]></content:encoded> </item> <item><title>By: Darik Gamble</title><link>http://undocumentedmatlab.com/blog/adding-context-menu-to-uitree/#comment-17</link> <dc:creator>Darik Gamble</dc:creator> <pubDate>Sat, 28 Mar 2009 02:20:45 +0000</pubDate> <guid
isPermaLink="false">http://undocumentedmatlab.com/?p=109#comment-17</guid> <description>Yair,I&#039;m glad to see you&#039;ve got a blog -- I remember learning from your newsgroup posts a couple years ago that I could add custom properties and event listeners to handle graphics objects, and both features have helped me immensely (and made it into the Matlab documention!)My votes on your to do list include customizing menus and the two schema topics.Cheers,dg</description> <content:encoded><![CDATA[<p>Yair,</p><p>I&#8217;m glad to see you&#8217;ve got a blog &#8212; I remember learning from your newsgroup posts a couple years ago that I could add custom properties and event listeners to handle graphics objects, and both features have helped me immensely (and made it into the Matlab documention!)</p><p>My votes on your to do list include customizing menus and the two schema topics.</p><p>Cheers,</p><p>dg</p> ]]></content:encoded> </item> </channel> </rss>

<!-- W3 Total Cache: Minify debug info:
Engine:             disk: basic
Theme:              b7666
Template:           single
-->
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Served from: undocumentedmatlab.com @ 2012-02-09 05:15:35 -->

<!-- W3 Total Cache: Page cache debug info:
Engine:             disk: enhanced
Cache key:          blog/adding-context-menu-to-uitree/feed/_index.xml_gzip
Caching:            enabled
Status:             not cached
Creation Time:      0.591s
Header info:
X-Pingback:         http://undocumentedmatlab.com/blog/xmlrpc.php
Set-Cookie:         wpgb_visit_last_php-default=1328789735; expires=Fri, 08-Feb-2013 12:15:35 GMT; path=/
Link:               <http://undocumentedmatlab.com/?p=109>; rel=shortlink
Content-Type:       text/xml; charset=UTF-8
Last-Modified:      Thu, 09 Feb 2012 12:15:35 GMT
Vary:               Accept-Encoding, Cookie
Expires:            Thu, 09 Feb 2012 13:15:35 GMT
Pragma:             public
Cache-Control:      public, must-revalidate, proxy-revalidate
Etag:               b2827dbda3a6591da770cb2cdec5e3ab
Content-Encoding:   gzip
-->
