kopele


I have a simple test page that uses the new class VECustomIconSpecification. I have a pushpin for which I want to add some text. Everything works fine except the method TextUnderline which when set to false does not work.

Is it something that has not been implemented yet

here is the code

function CreateMap()

{

map = new VEMap('myMap');

map.onLoadMap = EventMapLoad;

map.LoadMap(new VELatLong(21.30440,-157.82461),16,VEMapStyle.Aerial,false);

}

function EventMapLoad()

{

var my_color = new VEColor(0,0,0,1);

var pixel = new VEPixel(0, -25);

my_icon = new VECustomIconSpecification()

my_icon.Image = null

my_icon.TextSize = 15

my_icon.TextOffset = pixel

my_icon.ForeColor = my_color

my_icon.TextUnderline = false //this line does not work

var shape1 = new VEShape(VEShapeType.Pushpin,new VELatLong(21.30090,-157.82466));

shape1.SetDescription('Hello world');

shape1.SetCustomIcon(my_icon);

map.AddShape(shape1);

}

thanks




Re: the VECustomIconSpecification.TextUnderline method work?

Derek Chan


I don't think the "Text" properties actually apply to the description box, rather it only applies to the pushpin icon (which doesn't make it useful at all). You can change TextSize, TextItalics, TextUnderline and it will have no effect on the description (bubble) box. What I would recommend you do is encase the description within a <div> tag, while setting it to some class.

eg:

Code Snippet
shape1.SetDescription("<div class='DescriptionBox'>Hello world</div>");

Then set the appropriate styles within the class that you've set in a CSS file or inline HTML.

Hope that helps,






Re: the VECustomIconSpecification.TextUnderline method work?

kopele

Hi Derek,

thanks for your reply to my question.

I made a mistake and posted the wrong code, when I looked through my code there was nowhere text associated with the my_icon object. Here is the code that would make more sense to what I am refering is not working. Sorry for that, my first time that I posted something and managed to mess it up.

here is the actual

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Virtual Earth v5 API Sample - Simple VEShape Example</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script src="http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx v=5"></script>
<script type="text/javascript">
var map = null;
function EventMapLoad()
{

var my_color = new VEColor(0, 0, 0, 1);
var pixel = new VEPixel(0, -20);
my_icon = new VECustomIconSpecification
my_icon.TextContent = "here is the text"
my_icon.TextSize = 14
my_icon.ImageOffset = pixel
my_icon.ForeColor = my_color
my_icon.Underline = "false" // this is the line that is not working

//Add a pushpin
var shape1 = new VEShape(VEShapeType.Pushpin,new VELatLong(37.776, -122.426));
shape1.SetDescription('Pushpin');
shape1.SetCustomIcon(my_icon);
map.AddShape(shape1);

}

function CreateMap()
{
map = new VEMap('myMap');
map.onLoadMap = EventMapLoad;
map.LoadMap(new VELatLong(43.75, -99.71), 4, VEMapStyle.Road);
}
</script>
</head>
<body onload="CreateMap();">
<div id='myMap' style="position:relative; width:800px; height:600px;"></div>
</body>
</html>






Re: the VECustomIconSpecification.TextUnderline method work?

Derek Chan

Interesting, after looking through the code it does seem like a bug. Setting Textunderline and Underline properties to false both do nothing. What your seeing is a <div> tag with text, with the <div> tag having it's CSS Text-Decoration property set to underline.




Re: the VECustomIconSpecification.TextUnderline method work?

Oxcarz

I was not able to get this to work either. AND, I cant turn underline off using CSS inside the div tag:

myPin.SetCustomIcon("<div style='text-decoration:none; color: Red;'>some text</div>");

Strange behavior, becase all other css styles seem to work. In my example , color red works fine, as do all the other styles I have tried. I also tried defining a class:

<style type="text/css">

.myStyle {color: Red; text-decoration: none;}

</style>

then:

myPin.SetCustomIcon("<div class='.myStyle'>some text</div>");

This did not work either.