JoeBloggs


This is probably a simple one but I just can't find the answer.

I want to add a pushin to the map and have no infobox. At the moment when the pushpin is added it get a infobox containing "untitled item".

This is code I'm using

Code Snippet

<script src='http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx v=5'></script>
<script type='text/javascript'>
var map = null;
var pinid = 0;
var icon = 'Uploads/Siteimages/map_point.gif';
function load() {
map = new VEMap('map');
map.LoadMap(new VELatLong(54.804840, -7.769920), 7, 'r', false);
map.HideDashboard();
AddPushpin();
}
function AddPushpin() {
var shape = new VEShape(VEShapeType.Pushpin, map.GetCenter());
shape.SetCustomIcon(icon);
map.AddShape(shape);
pinid++;
}

You can view the map here




Re: Remove Infobox

Earthware


Hello

The way to acheive this is to add a custom handler for the map onmouseover event:

in your map setup method:

Code Snippet

map.AttachEvent("onmouseover",ShapeMouseOverHandler);

Then the method to handle this event needs to return false, this will stop the popup for all shapes

Code Snippet

//handles map mouse over events

function ShapeMouseOverHandler(e)

{

//return true to override normal behavoir

return true;

}

If you only want the popup to not appear for specific shapes then its best to add a shapelayer containing each type of shape and use code like this to decide what action to take for mouseover depending on the shape layer the shape is in

Code Snippet

//handles map mouse over events

function ShapeMouseOverHandler(e)

{

//check if mouse was even over a shape (rather than just the map)

if (e.elementID != null){

//get shape object by its id

var shape = map.GetShapeByID(e.elementID);

//check if shape is part of regions layer

if(regionslayer.GetShapeByID(shape.GetID())!=null){

//return true to supress popup as we dont want mouseover popups for regions

return true;

}

}

//return false to default to normal behavoir

return false;

}

regionslayer is defined and added to the map elsewhere

I hope this helps

Brian Norman

www.earthware.co.uk






Re: Remove Infobox

JoeBloggs

Thank you very much