TECShapeInfoWindow allows you to display a panel containing text.
Windows are managed by an TECShapeList list accessible through the property InfoWindows groups TECShapes
TECShapeInfoWindow
The following properties are available
property Color : TColorThe color of the border also sets the color of the closing cross.
1property BordeSize : integer
property XCurve : integer;
property YCurve : integer;
map.Shapes.InfoWindows[0].XCurve := 5;
map.Shapes.InfoWindows[0].YCurve := 5;
// group XYZ
map[XYZ].InfoWindows[0].XCurve := 10;
map[XYZ].InfoWindows[0].YCurve := 10;
property PeakLink : TInfoWindowPeakLink (iwpNone, iwpArrowHead)
iwpArrowHead displays a triangle pointing to the geographical position.
The length and the horizontal or vertical position of this one depend on the properties XAnchor and YAnchor which fix the offset in pixels compared to the real position.
property ArrowLX : integer;
property ArrowRX : integer
property Draggable : boolean
Allows to move the element with the mouse or the finger (default false)
ATTENTION if PeakLink = iwpArrowHead it is XAnchor and YAnchor that are modified and not the geographical position.
Switch to iwpNone to reposition your window geographically.
property Visible : boolean
property CloseButton : boolean
property ContentCenter : boolean
property Width : integer;
property Height : integer;
property Content : string
You can use a subset of HTML to enrich the display
2Tags <img>,<h>, <a> ,<b>, <i>, <u>, <s>, <font>, <br>,<tab> and <PlainText> are supported
map.Shapes.InfoWindows.add(map.latitude,map.longitude,
'content');
// html content
map.Shapes.InfoWindows[0].Content :=
'<h2><center>Titre</center></h2>'+
'<tab="32"><b>Bold</b><br>'+
'<tab="32"><font
face="Times New Roman" size=14 bkcolor=FF0000
color=FFFFFF>Font</font><br>'+
'<tab="32"><a
href="#16/43.094089/-0.046520">Link Lourdes</a>
<img
src="http://maps.google.com/mapfiles/ms/icons/orange-dot.png"
width=32 height=32>';
If you have assigned a TImageList to your map, you can use the image tag to display your icons, just enter the number in the parameter src
1mrk := map.addMarker(lat,lng);
mrk.infoWindow('<img src=2 width=48 height=48>');
If you use the center tag with text you cannot include any other tag.
1<h1><center>your text</center></h1>
<center><img src=xxx></center>
// not ok
<center><h1>your text</h1></center>
You can adjust the height of the line break
310 pixels line break <br=10 >
property OnOpen : TOnInfoWindowOpen;
This event is raised just before the window display, you can change the contents or cancel opening
...
procedure TForm.doOnOpenWindow(const infoWindow: TECShapeInfoWindow; var cancel: boolean);
begin
// set cancel to true for not open then infowindow (default false)
// cancel := true;
infoWindow.Content := 'change content here';
end;
When a window is closed by clicking on his cross the event OnCloseInfoWindow of TECNativeMap is raised and a TECShapeInfoWindow is passed as a parameter.
OnCloseInfoWindow does not occur if you close by using the property visible
1Automatic closing
Using an animation of type TECAnimationAutoHide you can close the window automatically after a few seconds.
...
win: = map. addInfoWindow (lat, lng);
// automatically close the window after 15 seconds
win.Animation := TECAnimationAutoHide.Create;
TECAnimationAutoHide (win.Animation).MaxTiming := 1000 * 15;
Link
You can set a link by using the <a> tag, to intercept the click Connect on the OnBeforeUrl event of your map, or on the OnLink window.
win := map.shapes.AddInfoWindow('<a href="#your_data"> link </a>');
win.OnLink := doOnInfoWindowLink;
win.setPosition(lat,lng);
win.visible := true;
...
procedure TForm.doOnInfoWindowLink(sender: TECShapeInfoWindow; const url:string);
begin
// here url = '#your_data'
end;
// global event if OnLink not assigned
Procedure TForm.mapBeforeUrl (Sender: TObject; var Url: string);
Begin
// here url = '#your_data'
End;
You have the option to set a special link that allows you to move around the map, it is of the form #zoom/latitude/longitude
// the move is automatic when processed in OnBeforeUrl,
// in OnLink you must add map.Url := url
win.OnLink := doOnLink;
...
procedure TForm.doOnLink(sender: TECShapeInfowWindow;const url:string);
begin
// this will trigger the OnBeforeUrl
map.Url := url;
end;
Automatic opening by clicking on an element
By switching the property UseInfoWindowDescription of your map to true, the field Description of the elements will be displayed as an infoWindow when you click on them.
You can access a global infoWindow through the InfoWindowDescription property.
map.InfoWindowDescription.minHeight := 300;
...
marker1.Description := '<h1>Marker 1</h1>';
line1.Description := '<h1>Line 1</h1>';