RodMcLeay


VE 5

Hi All,

I have a map with a few layers.

One layer has custom icons that are quite small, I dont want to show the info box for that layer at all.

It seems that the hide info box only hides an info box that is shown.

How can I stop an info box from showing at all for a particular layer.

Or all layers if not available layer by layer.

I have tried map.HideInfoBox(), but that will only hide a shown box, the next time I pass a icon, a new box is shown.

Many thanks for your time.

Rod




Re: Permanently Hide Info Box for layer

SoulSolutions


Rod,

You could add an event handler for all shapes and then do a simple check to see what layer it is in and cancel the event by returning true if that is the case.

So use:

VEMap.AttachEvent("onmouseover", function_name);

with your functionname eg function onMouseOver(e).

then the "e" which would be the MapEvent object has a "elementID" property.

Now you need to pass this into the function:

VEShapeLayer.GetShapeByID(ID);

Doesn't seem an easy way to find the actually layer except to loop through each layer and test, guess for your needs you just need to test the layer you want to hide info box and see if it returns an object.

John.







Re: Permanently Hide Info Box for layer

RodMcLeay

Thanks John,

That looks like viable option, I'll use that process.

Many thanks again

Rod






Re: Permanently Hide Info Box for layer

RodMcLeay

Thanks again John, worked a treat.

Code Snippet

function mouseOverHandler(e)

{

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

if(shape==null){return;}

for(var i=0;i<markerShapeLayer.GetShapeCount();i++ )

{

if(markerShapeLayer.GetShapeByIndex(i).GetTitle() == shape.GetTitle())

{

map.HideInfoBox();

return true;

}

}

}





Re: Permanently Hide Info Box for layer

SoulSolutions

Glad it solved your issue but I'm pretty sure (untested mind you) it should be simplier.

Give this a try:

Code Snippet

function mouseOverHandler(e)

{

if (e.elementID != null)

{

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

if(shape!=null)

{

return true;

}

}

}

Basic idea is you can find a shape within the layer you want to cancel and by returning true it cancels the infobox.

John.