[Users] Mouserover Events

Adam Ratcliffe adam at prema.co.nz
Tue Aug 10 13:04:38 CEST 2010


Have you tried the 'hover' constructor option for the SelectFeature control?  http://dev.openlayers.org/apidocs/files/OpenLayers/Control/SelectFeature-js.html

Cheers
Adam

On 10/08/2010, at 10:58 PM, Stefan Schwarzer wrote:

>>> thanks a lot for the tips. Just checked it out, but unfortunately I get a "TypeError: Result of expression 'this.map' [null] is not an object." in "OpenLayers.js:803" on the "sm: ....." line. Any idea what that can mean or what to do about it?
>> 
>> You need to add the SelectFeature control to the map and activate it,
>> as the FeatureSelectionModel won't do it for now.
> 
> Thanks for that.
> 
> I looked around and found this, which works for clicking, but not as mouse-over:
> 
> selectControl = new OpenLayers.Control.SelectFeature(vecLayer);
> map.addControl(selectControl);
> selectControl.activate();
> vecLayer.events.on({
> 	featureselected: function(e)
> 	{
> 		createPopup(e.feature);
> 	}
> });
> 
> 
> function createPopup(feature)
> {
> 	var content = "<div style='font-size:.9em; width:270px;'><b>" + feature.attributes.name + "</b><hr />" + "</div>";
> 	popup = new GeoExt.Popup({
> 		title: 'Details',
> 		feature: feature,
> 		width:270,
> 		height:170,
> 		html: content,
> 		collapsible: true
> 	});
> 	popup.on({
> 		close: function() 
> 		{
> 			if(OpenLayers.Util.indexOf(vecLayer.selectedFeatures, this.feature) > -1) 
> 			{
> 				selectControl.unselect(this.feature);
> 			}
> 		}
> 	});
> 	popup.show();
> }
> 
> 
> How can I turn this then into a mouse-over popup?
> 
> Thanks for any tips!
> 
> Stef
> _______________________________________________
> Users mailing list
> Users at geoext.org
> http://www.geoext.org/cgi-bin/mailman/listinfo/users



More information about the Users mailing list