CSUNRAE


Hi,

How do I add a pushpin without showing the detail bubble when you hover over the pin.

Basically I want to do this

  1. Add a push pin on a given latitude and longitude. (which I found)
  2. Disable the hovering of the pin bubble or description. (this is what I am after at)

Help is really appreciated.

Thanks,

Csunrae





Re: How do I add a pushpin without...

Earthware


Hi

Its a bit involved but here is how you do it:

1) After you have setup the map as normal add the following to you page load function in javascript which attaches the maps onclick event to a custom method.

Code Snippet
map.AttachEvent("onmouseover",ShapeMouseOverHandler);

2) Create a method called ShapeClickHandler as follows:

Code Snippet

function ShapeMouseOverHandler(e){

//check a shape was actually clicked on, rather than just the map itself

if (e.elementID != null){

//you can do other things here like work out

//what shapelayer the shape belongs to and act differently for differnt types of pushpin

//return true, therefore disabling the popup

return true;

}

return false;

}

thats it, if you never want the popup for anything you can simplify step 2 to:

Code Snippet

function ShapeMouseOverHandler(e){

return true;

}

Hope that helps

Brian Norman

www.earthware.co.uk






Re: How do I add a pushpin without...

CSUNRAE

Thanks for the reply brian.

But with your piece of code I won't be able to show any popup......... my intention is to disable the default popup and write a custom popup when a user hovers the mouse over the push pin............. makes sense.

Also I know you can custom fit the default popup.......... but I want to get the data on demand and show the popup.

Thanks,

Csunrae







Re: How do I add a pushpin without...

ssuing8825

Earthware was 50% there. Handle the onclick of the map and then display your popup.

Code Snippet

....load map continued .....


this.map.AttachEvent("onmouseover", DontShowDetails); //This suppresses normal popup
this.map.AttachEvent("onclick", mapclicked); //This will let you show yours.

function DontShowDetails(e)
{
//Check if it’s mouseover a shape
if(e.elementID != null)
{
return true;
}
}


}

function mapclicked(mapeventargs) {

if (mapeventargs.elementID !=null) //This must be a shape
{
//Display custom popup
}

}





Re: How do I add a pushpin without...

CSUNRAE

Thanks for the response.

Both of you are right there but you are telling me to overwrite the onmouseover behavior.

My problem is that "onmouseover" over a pushpin I want to show a custom bubble not the default one.

Thanks,

Csunrae






Re: How do I add a pushpin without...

Derek Chan

Putting what's been discussed already, in order to get a custom bubble your going to have to create your own <div> elements when the onmouseover event is fired which would "draw out" your bubble. To aid you in this you have the e.mapX and e.mapY co-ordinates to determine where you want your bubble/<div> to pop-up. You may need to do some CSS class modifications such as increasing the z-index (to give your div priority over the map layer) and overriding some of the API CSS classes as well.

Hope that helps,




Re: How do I add a pushpin without...

ssuing8825

The solution only opens with Orcas. But you can see the .js files in the 1.0 area

http://blogs.msdn.com/publicsector/archive/2007/05/08/update-virtual-earth-with-silverlight-sample.aspx





Re: How do I add a pushpin without...

beerthirty7

A much simpler way to disable the hovering pin bubble is to take your shape and set the Notes property to null. It's a bit hackish but it works in v5 of virtual earth.