chrismpace


hello is there a way to display the pin info as soon as you add the pin instead of the mouse hover over thanks.


Re: display pin info

Derek Chan


Not that I am aware of. The only way I could see that happening is actually hacking the actual VE control to do that. Anyone else got any ideas





Re: display pin info

SoulSolutions

No time to check sorry but try this:

after you add the pin:

var pin = new VEPushpin(pinID, latlon, icon_url, title, details, iconStyle);

map.AddPushpin(pin);

var element = document.getElementById(pinID);

element.onmouseover();

John







Re: display pin info

chrismpace

hello, i receive an error with that code.



Re: display pin info

Derek Chan

copy and paste the error code in another post




Re: display pin info

SoulSolutions

Yeah its been a busy week, wrong bit of code there.

Here is a full working example, I've added it to the wiki for the future.

http://viavirtualearth.com/Wiki/ActivatePinonAdd.ashx

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<script src="http://dev.virtualearth.net/mapcontrol/v4/mapcontrol.js" type="text/javascript"></script>
<script type="text/javascript">
var map = null;
var pinID = 1;

function GetMap()
{
map = new VEMap('myMap');
map.LoadMap();
}

function AddPin()
{
var pin = new VEPushpin(
pinID,
map.GetCenter(),
null,
'My pushpin',
'This is pushpin number '+pinID
);
map.AddPushpin(pin);
document.getElementById(pinID + "_" + map.GUID).onmouseover();
pinID++;
}
</script>
</head>
<body onload="GetMap();">
<div id='myMap' style="position:relative; width:400px; height:400px;"></div>
<a href="#" onclick="AddPin();">Add a pushpin to the center of the map</a>
</body>
</html>

John






Re: display pin info

chrismpace

works perfect! thanks!!



Re: display pin info

chrismpace

one last question, i would like to add the zoom to after that

map.SetZoomLevel(13);

but when i do, it takes the pop up away... any ideas thanks.





Re: display pin info

chrismpace

actually it works with your code, but when i place in mine, it doesnt work



Re: display pin info

Derek Chan

chrismpace wrote:
actually it works with your code, but when i place in mine, it doesnt work


Can you paste your code in




Re: display pin info

SoulSolutions

I suspect if the map moves it may stop the mouseover

Paste the minimal amount of your code and I'll have a look.

John.