### Marker InfoWindow

It is possible via the GoogleMaps API to show an Infowindow when clicking on a Marker (requires the JavaObject library).
Reference GoogleMaps API:
http://rterp.github.io/GMapsFX/apidocs/
OR
https://developers.google.com/maps/documentation/javascript/3.exp/reference#MarkerLabel
Define the Subs to Attach and Show an Info Window
'Attach an Infowindow to a Marker
'Uses a JavaObject (see API ref: http://rterp.github.io/GMapsFX/apidocs/ , select infowindow)
`Sub MarkerAttachInfoWindow (Marker As Marker, Text As String)
Dim infoWindow As JavaObject
infoWindow.InitializeNewInstance("com.lynden.gmapsfx.javascript.object.InfoWindow", Null)
infoWindow.RunMethod("setContent", Array (Text))
MarkerMap.Put(Marker, infoWindow)
End Sub`
Sub to Show an InfoWindow to a Marker
'Show an Infowindow assigned to a Marker
`Sub MarkerShowInfoWindow (Marker As Marker, map As GoogleMap)
If MarkerMap.ContainsKey(Marker) Then
Dim info As JavaObject = MarkerMap.Get(Marker)
Dim jMap As JavaObject = map
jMap = jMap.GetField("map")
info.RunMethod("open", Array (jMap, Marker))
End If
End Sub`
Assign InfoWindow to a Marker
'Define the GoogleMap Object
Private MapTrack As GoogleMap
'Define a Map holding the Markers
Private MarkerMap As Map
'Init the MarkerMap
MarkerMap.Initialize
In AddMarker attach an InfoWindow to a marker
'Note: This sub is not a standard sub
`Sub mapTrack_AddMarker(mLatLng As LatLng, mMarkerInfo As String, mIcon As String) As Marker
Log("mapTrack_AddMarker: Loc=" & mLatLng.Latitude & "/" & mLatLng.Longitude)
Dim Result As Marker
Result = MapTrack.AddMarker2(mLatLng.Latitude, mLatLng.Longitude, mMarkerInfo, File.GetUri(File.DirAssets, mIcon))
MarkerMap.Put(Result, mMarkerInfo)
MarkerAttachInfoWindow(Result, "" & mMarkerInfo & "")
Return Result
End Sub`
Note: The content is able to handle HTML formatted strings as shown in the example.
Handle the Click on a Marker to show the InfoWindow
`Sub maptrack_MarkerClick (SelectedMarker As Marker)
MarkerShowInfoWindow(SelectedMarker, MapTrack)
Dim title As String = MarkerMap.Get(SelectedMarker)
sbMain.Text = "Clicked on Marker " & title
End Sub`

Changed: , Category: Google Maps, File: T6C197M1449.htm, ID: 1449