It seems, that with every click you create a new info control. So deactivate works, but with the next click you activate a new control.
Arnd -----Ursprüngliche Nachricht----- Von: [email protected] [mailto:[email protected]] Im Auftrag von vrbikdan Gesendet: Freitag, 6. April 2012 10:50 An: [email protected] Betreff: [OpenLayers-Users] wmsGetFeatureInfo deactivate button Hi, I have really stupid question :) I have wmsGetFeatureInfo in my map and I want to add checkbox for enable and disable this info. Enable works, but disable don't and I don't know why. Maybe it could be better seen in code: function onclck(){ info = new OpenLayers.Control.WMSGetFeatureInfo({ url: "http://192.168.1.50:8080/geoserver/zk/wms", title: 'Identify features by clicking', queryVisible: true, eventListeners: { getfeatureinfo: function(event) { for (var i = 0; i < event.features.length; i++) { feature = event.features[i]; var attributes = feature.attributes; x=attributes.fid; for(var key in layers){ layers[key].mergeNewParams({env:"sel:"+x+";opacita:0.5"});}}}}}); map.addControl(info); if (document.forms.seznamVrstev.infoButt.checked){info.activate();} else{info.deactivate();} } This function I call on checkbox onclick. If I set info.deactivate(); out of if/else it works, but I need to deactivate when is checkbox unchecked. And when I try to set alerts in if/else, it works to, so I can't figure it out, why deactivate doesn't work. Is something I forgot? Thanks for help Dan -- View this message in context: http://osgeo-org.1560.n6.nabble.com/wmsGetFeatureInfo-deactivate-button-tp46 92153p4692153.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
