I'm running into this same problem. Did you find a solution to this?<div><br></div><div>Steve<br><br><div class="gmail_quote">On Tue, Feb 14, 2012 at 8:09 AM, GNR Revolution <span dir="ltr"><<a href="mailto:dieconnex@hotmail.com">dieconnex@hotmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi there,<br>
<br>
I'm fairly new to Openlayers, and I am having a problem that I cannot figure<br>
out so hoping someone can enlighten me. Basically I have a button that I<br>
wish to use to add or remove a control (in this case a legend image) to the<br>
map. The adding works fine, but even though I hit the removecontrol element<br>
of the code nothing happens, can anyone explain why? Code snippet is below,<br>
called by the button trigger:<br>
<br>
function GetLegendState() {<br>
if (bLegendState == false)<br>
{<br>
map.addControl (Legend);<br>
bLegendState = true;<br>
}<br>
else if (bLegendState == true)<br>
{<br>
map.removeControl (Legend);<br>
bLegendState = false;<br>
}<br>
else<br>
{<br>
}<br>
}<br>
<br>
The else if element is being reached (tested via alert) but the<br>
map.removeControl (Legend) doesn't seem to do anything?<br>
<font color="#888888"><br>
--<br>
View this message in context: <a href="http://osgeo-org.1560.n6.nabble.com/Remove-Layer-not-working-tp4468764p4468764.html" target="_blank">http://osgeo-org.1560.n6.nabble.com/Remove-Layer-not-working-tp4468764p4468764.html</a><br>
Sent from the OpenLayers Users mailing list archive at Nabble.com.<br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.osgeo.org">Users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/openlayers-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/openlayers-users</a><br>
</font></blockquote></div><br></div>