<HTML>
<style> BODY { font-family:Arial, Helvetica, sans-serif;font-size:12px; }</style><br>
Hi Mike,<br>
<br>
Thanks for the explanation, so far I think I understand.<br>
What I meant was the following:<br>
<br>
I can't figure out where I can get the layer variable from (containing the layer or layername that was right-clicked). You're passing the layer variable, but how do you get it to contain the right layer. Thats the main issue here. To simplify my problem:<br>
<br>
I have a context menu for the legend, containing an item: 'alert layer name', which functionality would be to do just that. I'd add these to lines to the Legend.Legendrenderer.<br>
<br>
this.alertLayernameAction= new Jx.Action(OpenLayers.Function.bind(alert( lyrName),null)); // (or something like that?)<br>
this.alertLayer= new Jx.MenuItem(this.executeRasterQueryAction, {label:OpenLayers.i18n('alert layer name')});<br>
<br>
My issue her is where do I get lyrname from? Is the name of the node that was right-clicked available somewhere?<br>
<br>
Hope this is clearer, thanks so much!<br>
<br>
Tom<br>
<br>
<span style="font-weight: bold;">On Thu 15/04/10 17:25 , Mike Adair madair@dmsolutions.ca sent:<br>
</span><blockquote style="border-left: 2px solid rgb(245, 245, 245); margin-left: 5px; margin-right: 0px; padding-left: 5px; padding-right: 0px;">Tom,<br>

<br>

Then your getRasterQuery method would look like:<br>

<br>

function getRasterQuery(layer) {<br>

    var temp = layer.name;<br>

...<br>

}<br>

<br>

For the OpenLayers.Function.bind method, the first arg is the method to <br>

be bound, the second arg is the object to bind to (object will be 'this' <br>

inside the method), and then the rest of the arguments will be passed to <br>

the bound method as arguments.<br>

<br>

Mike<br>

<br>

<br>

Tom van der Putte wrote:<br>

<span style="color: rgb(102, 102, 102);">&gt; Hi Mike,</span><br>

<span style="color: rgb(102, 102, 102);">&gt;</span><br>

<span style="color: rgb(102, 102, 102);">&gt; I was trying your solution, but I'm still a bit confused.</span><br>

<span style="color: rgb(102, 102, 102);">&gt;</span><br>

<span style="color: rgb(102, 102, 102);">&gt; This is my current code (within Legend.LegendRenderer)</span><br>

<span style="color: rgb(102, 102, 102);">&gt;</span><br>

<span style="color: rgb(102, 102, 102);">&gt; this.executeRasterQueryAction = new </span><br>

<span style="color: rgb(102, 102, 102);">&gt; Jx.Action(OpenLayers.Function.bind(this.getRasterQuery, this));</span><br>

<span style="color: rgb(102, 102, 102);">&gt; this.executeRasterQueryItem = new </span><br>

<span style="color: rgb(102, 102, 102);">&gt; Jx.MenuItem(this.executeRasterQueryAction, {label: </span><br>

<span style="color: rgb(102, 102, 102);">&gt; OpenLayers.i18n('Execute raster query')});</span><br>

<span style="color: rgb(102, 102, 102);">&gt;</span><br>

<span style="color: rgb(102, 102, 102);">&gt; According to your explanation, the first line should then be:</span><br>

<span style="color: rgb(102, 102, 102);">&gt;</span><br>

<span style="color: rgb(102, 102, 102);">&gt; this.executeRasterQueryAction = new </span><br>

<span style="color: rgb(102, 102, 102);">&gt; Jx.Action(OpenLayers.Function.bind(this.getRasterQuery, this, layer));</span><br>

<span style="color: rgb(102, 102, 102);">&gt;</span><br>

<span style="color: rgb(102, 102, 102);">&gt; Or am I wrong here? But how do I get the reference to the layer thats </span><br>

<span style="color: rgb(102, 102, 102);">&gt; clicked? Does that make sense what I'm saying? :) I'm not really into </span><br>

<span style="color: rgb(102, 102, 102);">&gt; the whole binding stuuf yet. Getting there though...</span><br>

<span style="color: rgb(102, 102, 102);">&gt;</span><br>

<span style="color: rgb(102, 102, 102);">&gt; Cheers,</span><br>

<span style="color: rgb(102, 102, 102);">&gt; Tom</span><br>

<span style="color: rgb(102, 102, 102);">&gt;</span><br>

<span style="color: rgb(102, 102, 102);">&gt;</span><br>

<span style="color: rgb(102, 102, 102);">&gt;</span><br>

<span style="color: rgb(102, 102, 102);">&gt; On Thu 15/04/10 15:52 , Mike Adair <a href="javascript:top.opencompose('madair@dmsolutions.ca','','','')">madair@dmsolutions.ca</a> sent:</span><br>

<span style="color: rgb(102, 102, 102);">&gt;</span><br>

<span style="color: rgb(102, 102, 102);">&gt;     Tom,</span><br>

<span style="color: rgb(102, 102, 102);">&gt;</span><br>

<span style="color: rgb(102, 102, 102);">&gt;     The menu items are only bound to the legend tree items/folders at</span><br>

<span style="color: rgb(102, 102, 102);">&gt;     this</span><br>

<span style="color: rgb(102, 102, 102);">&gt;     point. I think what you would need to do is bind whatever object you</span><br>

<span style="color: rgb(102, 102, 102);">&gt;     need when setting up your onclick event, eg. the existing code</span><br>

<span style="color: rgb(102, 102, 102);">&gt;     looks like:</span><br>

<span style="color: rgb(102, 102, 102);">&gt;     onClick:</span><br>

<span style="color: rgb(102, 102, 102);">&gt;     OpenLayers.Function.bind(this.collapseBranch, this, this.oRoot)</span><br>

<span style="color: rgb(102, 102, 102);">&gt;</span><br>

<span style="color: rgb(102, 102, 102);">&gt;     but you probably want:</span><br>

<span style="color: rgb(102, 102, 102);">&gt;</span><br>

<span style="color: rgb(102, 102, 102);">&gt;     onClick:</span><br>

<span style="color: rgb(102, 102, 102);">&gt;     OpenLayers.Function.bind(this.collapseBranch, this, this.oRoot, layer)</span><br>

<span style="color: rgb(102, 102, 102);">&gt;</span><br>

<span style="color: rgb(102, 102, 102);">&gt;     (or similar) and then in the method being bound, layer will appear as</span><br>

<span style="color: rgb(102, 102, 102);">&gt;     one of the arguments.</span><br>

<span style="color: rgb(102, 102, 102);">&gt;</span><br>

<span style="color: rgb(102, 102, 102);">&gt;</span><br>

<span style="color: rgb(102, 102, 102);">&gt;     Mike</span><br>

<span style="color: rgb(102, 102, 102);">&gt;</span><br>

<span style="color: rgb(102, 102, 102);">&gt;</span><br>

<span style="color: rgb(102, 102, 102);">&gt;     Tom van der Putte wrote:</span><br>

<span style="color: rgb(102, 102, 102);">&gt;     &gt; Hi All,</span><br>

<span style="color: rgb(102, 102, 102);">&gt;     &gt;</span><br>

<span style="color: rgb(102, 102, 102);">&gt;     &gt; When right-clicking an item in the legend, a context manu appears.</span><br>

<span style="color: rgb(102, 102, 102);">&gt;     &gt; I've added a entry to this menu, and clicking on it results in a</span><br>

<span style="color: rgb(102, 102, 102);">&gt;     &gt; certain function beeing executed. However, I want to check if the</span><br>

<span style="color: rgb(102, 102, 102);">&gt;     item</span><br>

<span style="color: rgb(102, 102, 102);">&gt;     &gt; that was right-clicked in the legend is of a certain type. How can I</span><br>

<span style="color: rgb(102, 102, 102);">&gt;     &gt; get to the layer name? I found something like targetFolder in the</span><br>

<span style="color: rgb(102, 102, 102);">&gt;     &gt; legend widget, but this obviously goes only for the folders?</span><br>

<span style="color: rgb(102, 102, 102);">&gt;     &gt;</span><br>

<span style="color: rgb(102, 102, 102);">&gt;     &gt; Cheers,</span><br>

<span style="color: rgb(102, 102, 102);">&gt;     &gt;</span><br>

<span style="color: rgb(102, 102, 102);">&gt;     &gt; Tom</span><br>

<span style="color: rgb(102, 102, 102);">&gt;     &gt; ------------------------------------------------------------------------</span><br>

<span style="color: rgb(102, 102, 102);">&gt;     &gt;</span><br>

<span style="color: rgb(102, 102, 102);">&gt;     &gt; _______________________________________________</span><br>

<span style="color: rgb(102, 102, 102);">&gt;     &gt; fusion-users mailing list</span><br>

<span style="color: rgb(102, 102, 102);">&gt;     &gt; <a href="javascript:top.opencompose('fusion-users@lists.osgeo.org','','','')">fusion-users@lists.osgeo.org</a></span><br>

<span style="color: rgb(102, 102, 102);">&gt;     <javascript:top.opencompose('fusion-users@lists.osgeo.org','','','')></javascript:top.opencompose('fusion-users@lists.osgeo.org','','','')></span><br>

<span style="color: rgb(102, 102, 102);">&gt;     &gt; <a target="_blank" href="parse.php?redirect=http%3A%2F%2Flists.osgeo.org%2Fmailman%2Flistinfo%2Ffusion-users"><span style="color: red;">http://lists.osgeo.org/mailman/listinfo/fusion-users</span></a></span><br>

<span style="color: rgb(102, 102, 102);">&gt;     <parse.php?redirect=http%3a%2f%2flists.osgeo.org%2fmailman%2flistinfo%2ffusion-users></parse.php?redirect=http%3a%2f%2flists.osgeo.org%2fmailman%2flistinfo%2ffusion-users></span><br>

<span style="color: rgb(102, 102, 102);">&gt;     &gt;</span><br>

<span style="color: rgb(102, 102, 102);">&gt;</span><br>

<span style="color: rgb(102, 102, 102);">&gt;     -- </span><br>

<span style="color: rgb(102, 102, 102);">&gt;     Michael Adair</span><br>

<span style="color: rgb(102, 102, 102);">&gt;     Senior Software Architect</span><br>

<span style="color: rgb(102, 102, 102);">&gt;     DM Solutions Group Inc.</span><br>

<span style="color: rgb(102, 102, 102);">&gt;</span><br>

<span style="color: rgb(102, 102, 102);">&gt;     Office: (613) 565-5056 x26</span><br>

<span style="color: rgb(102, 102, 102);">&gt;     <a href="javascript:top.opencompose('madair@dmsolutions.ca','','','')">madair@dmsolutions.ca</a></span><br>

<span style="color: rgb(102, 102, 102);">&gt;     <javascript:top.opencompose('madair@dmsolutions.ca','','','')></javascript:top.opencompose('madair@dmsolutions.ca','','','')></span><br>

<span style="color: rgb(102, 102, 102);">&gt;     <a target="_blank" href="parse.php?redirect=http%3A%2F%2Fwww.dmsolutions.ca"><span style="color: red;">http://www.dmsolutions.ca</span></a></span><br>

<span style="color: rgb(102, 102, 102);">&gt;     <parse.php?redirect=http%3a%2f%2f><a target="_blank" href="parse.php?redirect=<a href="http://www.dmsolutions.ca">http://www.dmsolutions.ca</a>">www.dmsolutions.ca</a>&gt;</parse.php?redirect=http%3a%2f%2f></span><br>

<span style="color: rgb(102, 102, 102);">&gt;     <a target="_blank" href="parse.php?redirect=http%3A%2F%2Fresearch.dmsolutions.ca"><span style="color: red;">http://research.dmsolutions.ca</span></a></span><br>

<span style="color: rgb(102, 102, 102);">&gt;     <parse.php?redirect=http%3a%2f%2fresearch.dmsolutions.ca></parse.php?redirect=http%3a%2f%2fresearch.dmsolutions.ca></span><br>

<span style="color: rgb(102, 102, 102);">&gt;</span><br>

<span style="color: rgb(102, 102, 102);">&gt;</span><br>

<span style="color: rgb(102, 102, 102);">&gt;</span><br>

<br>

-- <br>

   Michael Adair<br>

   Senior Software Architect<br>

   DM Solutions Group Inc.<br>

<br>

   Office: (613) 565-5056 x26<br>

   <a href="javascript:top.opencompose('madair@dmsolutions.ca','','','')">madair@dmsolutions.ca</a><br>

   <a target="_blank" href="parse.php?redirect=http%3A%2F%2Fwww.dmsolutions.ca"><span style="color: red;">http://www.dmsolutions.ca</span></a><br>

   <a target="_blank" href="parse.php?redirect=http%3A%2F%2Fresearch.dmsolutions.ca"><span style="color: red;">http://research.dmsolutions.ca</span></a><br>

<br>

<br>

<br>

</blockquote></HTML>