iOS Question Automatically "press" the Marker in Google Map

Karsten Madsen

Member
Licensed User
I'm setting up a Map, where multiply locations is shown. Right now i use AddMarker3 to add a picture.
When I press on of the markers it shows a Panel containing af text and a image.
I'd like to have the markers to press themselves to automatically show all the panels at once - and the user should be able to hide/remove the panels
20210714_125254.jpg

Sorry for the quality
How do I run gmap_MarkerInfoWindow(...) as a part of the code

B4X:
Sub RunLoop

For i = 0 To fl.Size - 1
        l = fl.Get(i)
        If l.Contains(".wo") Then
            ftp.Initialize("ftp", "ftp.myftpserver.dk", 21, "myUser","myPassword")
            ftp.PassiveMode=True
            Wait For (ftp.downloadFile(l, True, File.DirDocuments, l))     FTP_DownloadCompleted (ServerPath As String, Success As Boolean)

            If Success = True Then
                
                '****NON IMPORTANT CODE FOR THIS EXAMPLE (BEGIN) ****
                li = RSFF(l)  
               
                tempString = OplosCSV(li,6,",")   
                If tempString.Trim = "" Then lat = 0 Else lat = tempString
                tempString = OplosCSV(li,7,",")
                If tempString.Trim = "" Then lon = 0 Else lon = tempString
                tempString= OplosCSV (li, 0, ",")
                 '****NON IMPORTANT CODE FOR THIS EXAMPLE (END) ****
              
                Dim bmp As Bitmap = LoadBitmapResize(File.DirAssets, "dot.png",10,10,True)
                m = gmap.AddMarker3(lat, lon, "marker3", CreateBitmap("L1"))
            End If
        End If
    Next
End Sub


Sub gmap_MarkerInfoWindow (OMarker As Object) As Object

    Dim SelectedMarker As Marker = OMarker
    Dim p As Panel
    p.Initialize("")
   
    If SelectedMarker.Title = "" Then Return p
    
    Dim c As String = SelectedMarker.Tag
    p.SetColorAnimated(0, Colors.Transparent)
    p.SetBorder(0,Colors.Transparent,0)
    If c = "D" Then p.SetBorder(2, 0xffFF005D, 10) Else  p.SetBorder(2, 0xff003BFF, 10)
    p.SetLayoutAnimated(0,1,0,0,300,140)

    Dim img As ImageView
    img.Initialize("")
    img.Bitmap = LoadBitmap(File.DirAssets, "Adam.png")  'File.DirAssets and Adam.png are only for testing
    p.AddView(img,120,80,60,60)
    img.BringToFront

    Dim imgTB As ImageView
    imgTB.Initialize("")
    imgTB.Bitmap = LoadBitmap(File.DirAssets, "Talebobbel-center.png")
    p.AddView(imgTB,40,10,130,60)
    imgTB.SendToBack
    
    Dim lbl1 As Label
    lbl1.Initialize("")
    lbl1.Text = SelectedMarker.Snippet
    lbl1.Font=Font.CreateNew2("Montserrat-light", 12)
    lbl1.Multiline=True
    lbl1.TextAlignment=    lbl1.ALIGNMENT_CENTER
    lbl1.AdjustFontSizeToFit=True
    lbl1.BringToFront
    
    Dim lbl2 As Label
    lbl2.Initialize("")
    lbl2.Text = OplosCSV(SelectedMarker.Title,3,"-")
    p.AddView(lbl2, 300, 40, 230, 40)
       
    Return p

End Sub
 

Karsten Madsen

Member
Licensed User
Thanks

I did like this

B4X:
                gmap.As(NativeObject).SetField("selectedMarker", m)
after
m = gmap.AddMarker3(lat, lon, "marker3", CreateBitmap("L1"))


But it didn't work

How do I put a image and a text on each location I get in the for-nex-loop
 
Upvote 0

Similar Threads

Top