I&#39;ve taken the select control out entirely, and the highlight works independently of the select control. Do I need to specify a click handler? <br><br><div class="gmail_quote">On Tue, Jun 16, 2009 at 4:39 PM, Eric Lemoine <span dir="ltr">&lt;<a href="mailto:eric.lemoine@camptocamp.com">eric.lemoine@camptocamp.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">On Tuesday, June 16, 2009, Nicholas Efremov-Kendall<br>
<div class="im">&lt;<a href="mailto:n.e.kendall@gmail.com">n.e.kendall@gmail.com</a>&gt; wrote:<br>
&gt; Hi all,<br>
&gt;<br>
&gt; another novice error probably. I&#39;m trying to replicate the function of the click to select, highlight selected example. I essentially copy/pasted the example into my code, but I&#39;m perplexed as to why I don&#39;t have the select on click feature activated? The highlighting works fine, but nothing happens when I click. My current set up is very close to the example, except I use a local gml rather than the vectors from the wkt geometry.<br>

&gt; here&#39;s my code, and I&#39;m using the web-url for the code.<br>
<br>
</div>Looking at your code I have no idea what&#39;s wrong. Have you try<br>
removing the hover (highlightOnly) control to see if the click control<br>
then works?<br>
<div><div></div><div class="h5"><br>
&gt;<br>
&gt; var map, controls;<br>
&gt; function init() {<br>
&gt;             map = new OpenLayers.Map (&quot;map&quot;,<br>
&gt;                     {<br>
&gt;                     controls:[<br>
&gt;                     new OpenLayers.Control.Navigation(),<br>
&gt;                     new OpenLayers.Control.PanZoomBar(),<br>
&gt;                     new OpenLayers.Control.LayerSwitcher(),<br>
&gt;                     new OpenLayers.Control.Attribution()],<br>
&gt;                 sphericalMercator: true,<br>
&gt;                 maxExtent: new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34),<br>
&gt;                 maxResolution: 156543.0399,<br>
&gt;                 numZoomLevels: 19,<br>
&gt;                 units: &#39;m&#39;,<br>
&gt;                 projection: new OpenLayers.Projection(&quot;EPSG:900913&quot;),<br>
&gt;                 displayProjection: new OpenLayers.Projection(&quot;EPSG:4326&quot;),<br>
&gt;                     }<br>
&gt;             );<br>
&gt;             var myBaseLayer = new OpenLayers.Layer.WMS( &quot;OpenLayers WMS&quot;,<br>
&gt;         &quot;<a href="http://labs.metacarta.com/wms/vmap0" target="_blank">http://labs.metacarta.com/wms/vmap0</a>&quot;, {layers: &#39;basic&#39;, projection: &quot;myproj&quot;} );<br>
&gt;          map.addLayer(myBaseLayer);<br>
&gt;<br>
&gt;          var topo = new OpenLayers.Layer.GML(&quot;Topography&quot;, &quot;data/test4.gml&quot;, {<br>
&gt;   projection: new OpenLayers.Projection(&quot;EPSG:4326&quot;)});<br>
&gt;          map.addLayer(topo);<br>
&gt; // Selection and hoverstate controls<br>
&gt;           var report = function(e) {<br>
&gt;                 OpenLayers.Console.log(e.type, <a href="http://e.feature.id" target="_blank">e.feature.id</a>);<br>
&gt;             };<br>
&gt;<br>
&gt;             var highlightCtrl = new OpenLayers.Control.SelectFeature(topo, {<br>
&gt;                 hover: true,<br>
&gt;                 highlightOnly: true,<br>
&gt;                 renderIntent: &quot;temporary&quot;,<br>
&gt;                 eventListeners: {<br>
&gt;                     beforefeaturehighlighted: report,<br>
&gt;                     featurehighlighted: report,<br>
&gt;                     featureunhighlighted: report<br>
&gt;                 }<br>
&gt;             });<br>
&gt;<br>
&gt;    var selectCtrl = new OpenLayers.Control.SelectFeature(topo,<br>
&gt;                 {clickout: true}<br>
&gt;             );<br>
&gt;<br>
&gt;             map.addControl(highlightCtrl);<br>
&gt;               map.addControl(selectCtrl);<br>
&gt;<br>
&gt;             highlightCtrl.activate();<br>
&gt;             selectCtrl.activate();<br>
&gt;<br>
&gt;             if( ! map.getCenter() ){<br>
&gt;             topo.events.register(&#39;loadend&#39;, topo, function(){map.zoomToExtent(topo.getDataExtent())});<br>
&gt;             map.setCenter(null, null);<br>
&gt;             };<br>
&gt;             }<br>
&gt;<br>
&gt;<br>
<br>
</div></div>--<br>
Eric Lemoine<br>
<br>
Camptocamp France SAS<br>
Savoie Technolac, BP 352<br>
73377 Le Bourget du Lac, Cedex<br>
<br>
Tel : 00 33 4 79 44 44 96<br>
Mail : <a href="mailto:eric.lemoine@camptocamp.com">eric.lemoine@camptocamp.com</a><br>
<a href="http://www.camptocamp.com" target="_blank">http://www.camptocamp.com</a><br>
</blockquote></div><br>