[OpenLayers-Users] Weird click handler error

Semantica jvanulde at nrcan.gc.ca
Fri Nov 14 15:23:20 EST 2008


I have remapped the single 'click' handler and am getting the following
error:

Error: uncaught exception: [Exception... "Illegal operation on WrappedNative
prototype object"  nsresult: "0x8057000c (NS_ERROR_XPC_BAD_OP_ON_WN_PROTO)" 
location: "JS frame ::
http://dev.openlayers.org/sandbox/jvanulden/openlayers/lib/OpenLayers/Events.js
:: anonymous :: line 138"  data: no]

You can replicate by:

1. going to:
http://dev.openlayers.org/sandbox/jvanulden/openlayers/examples/extended-layerswitcher.html 
2. opening the legend (layerSwitcher)
3. clicking on the title of a layer (i.e. "Country Capital City Names") to
make it active
4. then single click the map

CODE SNIPPET:

// create a new event handler for single click query
var clickEventHandler = new OpenLayers.Handler.Click({ 'map': map }, {
'click': function(e) { doGetFeatureInfo(e); } }); 
clickEventHandler.activate();
         

function doGetFeatureInfo(evt)
{
   var layerId = layerSwitcher.activeLayer;
   
   if(evt)
   {
       var activeLayer = map.getLayer(layerId); 
               
       if(activeLayer)
       {        
            var url =   activeLayer.getFullRequestString({
                        REQUEST: "GetFeatureInfo",
                        EXCEPTIONS: "application/vnd.ogc.se_xml",
                        BBOX: activeLayer.map.getExtent().toBBOX(),
                        X: evt.xy.x,
                        Y: evt.xy.y,
                        INFO_FORMAT: 'text/html',
                        QUERY_LAYERS: activeLayer.params.LAYERS,
                        WIDTH: activeLayer.map.size.w,
                        HEIGHT: activeLayer.map.size.h});
                            
            var popupWindow = window.open(url, "GetFeatureInfo",
"width=550,height=350,status=yes,scrollbars=yes,resizable=yes");
                   
					if(popupWindow)
					{
						popupWindow.focus();
					}
					else
					{
						return true;
					}
                    
                    OpenLayers.Event.stop(evt);      
           
                }
            }
        }

END CODE SNIPPET

Any ideas on what may be causing this???

Thank you in advance!



-- 
View this message in context: http://n2.nabble.com/Weird-click-handler-error-tp1500003p1500003.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.




More information about the Users mailing list