<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type>
<STYLE type=text/css>DIV {
        MARGIN: 0px
}
</STYLE>
<META name=GENERATOR content="MSHTML 8.00.6001.18999"></HEAD>
<BODY>
<DIV><FONT color=#0000ff><FONT face=Arial><FONT size=2> <SPAN
class=560582717-12012011><FONT color=#000000>Although I am not familiar with
getting a right click context menu to work (yet).. I do have a layer opacity
control that works for each layer on my current map. I am just using the
GeoExt.LayerOpacitySlider that I add to an Ext Window and when the user clicks a
button in my toolbar it pops up and lists all the layers of the current map.
</FONT></SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT color=#0000ff size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial><SPAN class=560582717-12012011>The actual control
is declared like - </SPAN></FONT></DIV>
<DIV><FONT color=#0000ff size=2 face=Arial></FONT> </DIV>
<DIV><FONT color=#0000ff size=2 face=Arial>//Function to add Opacity Slider to
Top Window (Opacity Window)<BR> function addOpacity()
{<BR> var controlOptions =
{<BR> renderTo:
Ext.get('opacity_slider'),<BR> width:
160,<BR> layer:
layer_Base,<BR>
id:
'slider_opacity'<BR>
};<BR>
slider = new
GeoExt.LayerOpacitySlider(controlOptions);<BR>
var slider_layername =
slider.layer.name;<BR>
}; </FONT></DIV>
<DIV><FONT color=#0000ff size=2 face=Arial></FONT> </DIV>
<DIV><SPAN class=560582717-12012011><FONT size=2 face=Arial>I have it initially
setup to change Opacity of my base layer. Below is my code basically that uses
radio buttons on the ext window and when the user clicks on a different layer,
the layer for the control is modified to change the opacity of that layer
instead.</FONT></SPAN></DIV>
<DIV><FONT color=#0000ff size=2 face=Arial></FONT> </DIV>
<DIV><FONT color=#0000ff size=2 face=Arial> //Function to determine which
layer is selected for opacity change <BR> function
toggleSet(rad)<BR> {<BR> var name =
rad.value;</FONT></DIV>
<DIV> </DIV>
<DIV><FONT color=#0000ff size=2 face=Arial> switch
(name)<BR> {<BR> case
'Labels':<BR> document.getElementById('layers').innerHTML =
'Current Layer: Labels';<BR> slider.layer =
layer_Labels;<BR> break;<BR>
<BR> case 'AOI':<BR>
document.getElementById('layers').innerHTML = 'Current Layer: Areas of
Interest';<BR> slider.layer =
layer_AOIs;<BR> break;<BR>
<BR> case 'Trails':<BR>
document.getElementById('layers').innerHTML = 'Current Layer:
Trails';<BR> slider.layer =
layer_Trails;<BR> break;
<BR> <BR> case
'Footprints':<BR> document.getElementById('layers').innerHTML
= 'Current Layer: Building Footprints';<BR> slider.layer =
layer_Footprints;<BR> break;
<BR> <BR> case
'Legal':<BR> document.getElementById('layers').innerHTML =
'Current Layer: Legal Fabric';<BR> slider.layer =
layer_Legal_Fabric;<BR> break;
<BR> <BR> case
'Parcel':<BR> document.getElementById('layers').innerHTML =
'Current Layer: Parcel Fabric';<BR> slider.layer =
layer_Parcel_Fabric;<BR> break;
</FONT></DIV>
<DIV> </DIV>
<DIV><FONT color=#0000ff size=2 face=Arial> case
'Base':<BR> document.getElementById('layers').innerHTML =
'Current Layer: Base Layer';<BR> slider.layer =
layer_Base;<BR> break;
<BR> <BR> case 'Orthos':<BR>
document.getElementById('layers').innerHTML = 'Current Layer: Ortho
Images';<BR> slider.layer =
layer_Orthos;<BR> break;
<BR> }<BR> }</FONT></DIV>
<DIV><FONT color=#0000ff size=2 face=Arial></FONT> </DIV>
<DIV><SPAN class=560582717-12012011><FONT color=#0000ff size=2 face=Arial>And
here is the actual window with the radio buttons/form to call ToggleSet
function</FONT></SPAN></DIV>
<DIV><SPAN class=560582717-12012011><FONT color=#0000ff size=2
face=Arial></FONT></SPAN> </DIV>
<DIV><SPAN class=560582717-12012011><FONT color=#0000ff size=2 face=Arial>
//Opacity Switcher Window<BR> var
window_SwitchOpacity = new
Ext.Window({<BR> title:
'Change Layer
Opacity',<BR> width:
'20%',<BR> height:
'55%',<BR> closeAction:
'hide',<BR> closeable:
true,<BR> collapsible:
true,<BR> titleCollapse:
true,<BR> frame:
true,<BR> html: '<div
id="opacity_slider"></div><br/><div id="layers">Current
Layer: Base</div><form name="form_opacity"><div
align="left"><br><input type="radio" name="layers" value="Labels"
onclick="toggleSet(this);"> Labels<br><input type="radio"
name="layers" value="AOI" onclick="toggleSet(this)"> Areas of
Interest<br><input type="radio" name="layers" value="Trails"
onclick="toggleSet(this)"> Trails<br><input type="radio"
name="layers" value="Footprints" onclick="toggleSet(this)"> Building
Footprints<br><input type="radio" name="layers" value="Legal"
onclick="toggleSet(this)"> Legal Fabric<br><input type="radio"
name="layers" value="Parcel" onclick="toggleSet(this)"> Parcel
Fabric<br><input type="radio" name="layers" value="Base"
onclick="toggleSet(this)" checked> Base Layer<br><input type="radio"
name="layers" value="Orthos" onclick="toggleSet(this)"> Ortho
Images</div></form>',<BR>
listeners: {'afterlayout': {fn: addOpacity, single: true}}
<BR>
});</FONT></SPAN></DIV>
<DIV><SPAN class=560582717-12012011><FONT color=#0000ff size=2
face=Arial></FONT></SPAN> </DIV>
<DIV><SPAN class=560582717-12012011><FONT color=#0000ff size=2
face=Arial></FONT></SPAN> </DIV>
<DIV><FONT color=#0000ff size=2 face=Arial></FONT> </DIV>
<DIV><FONT color=#0000ff size=2 face=Arial></FONT> </DIV>
<DIV><SPAN class=560582717-12012011><FONT size=2 face=Arial>Hope this is of some
assistance.. I'm sure you can modify this to fit anything else as in doesn't
have to be inside an ext window or use radio buttons. Also I'm sure there is a
better way/more efficient way to accomplish something like this as this is just
a trial control for me and not my final one.... still has much work to
go.</FONT></SPAN></DIV>
<DIV><BR></DIV>
<DIV dir=ltr lang=en-us class=OutlookMessageHeader align=left>
<HR tabIndex=-1>
<FONT size=2 face=Tahoma><B>From:</B> users-bounces@geoext.org
[mailto:users-bounces@geoext.org] <B>On Behalf Of </B>Robert
Buckley<BR><B>Sent:</B> January 12, 2011 10:27 AM<BR><B>To:</B>
users@geoext.org<BR><B>Subject:</B> [Users] Context menu on rightclick of tree
node<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV style="FONT-FAMILY: arial,helvetica,sans-serif; FONT-SIZE: 8pt">
<DIV><SPAN style="CURSOR: pointer" class=cgSelectable
title="Alle Mails mit diesem Betreff anzeigen">Hi,<BR><BR>I do need a
programmer, but I also would like to learn this stuff. It´s a slow hard
struggle!!!<BR><BR>Yours,<BR><BR>Robert<BR>
<BR></SPAN></DIV></DIV><BR>
<DIV>
<P>
<HR>
[This message has been scanned for security content threats and
viruses.]<BR><BR>[The City of Red Deer I.T. Services asks that you please
consider the environment before printing this e-mail.]<BR>
<P></P></DIV>
<DIV><P><HR>
This e-mail is intended for the original recipient(s) only. If you have received it in error, please advise the sender and delete this message.
</P></DIV>
</BODY></HTML>