I'm running into this same problem. Did you find a solution to this?

Steve

On Tue, Feb 14, 2012 at 8:09 AM, GNR Revolution <[email protected]>wrote:

> Hi there,
>
> I'm fairly new to Openlayers, and I am having a problem that I cannot
> figure
> out so hoping someone can enlighten me.  Basically I have a button that I
> wish to use to add or remove a control (in this case a legend image) to the
> map.  The adding works fine, but even though I hit the removecontrol
> element
> of the code nothing happens, can anyone explain why?  Code snippet is
> below,
> called by the button trigger:
>
>        function GetLegendState() {
>                if (bLegendState == false)
>                        {
>                        map.addControl (Legend);
>                        bLegendState = true;
>                        }
>                else if (bLegendState == true)
>                        {
>                        map.removeControl (Legend);
>                        bLegendState = false;
>                        }
>                else
>                        {
>                        }
>           }
>
> The else if element is being reached (tested via alert) but the
> map.removeControl (Legend) doesn't seem to do anything?
>
> --
> View this message in context:
> http://osgeo-org.1560.n6.nabble.com/Remove-Layer-not-working-tp4468764p4468764.html
> Sent from the OpenLayers Users mailing list archive at Nabble.com.
> _______________________________________________
> Users mailing list
> [email protected]
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users

Reply via email to