B4J Question jGoogleMaps Circle

Pedro Caldeira

Active Member
Licensed User
Longtime User
Hello,
I am trying to add a circle and then remove it. The Adding part is easy, but I get a non initialized circle error when trying to remove it. Why ?

B4X:
Sub ShowRanges(Show as boolean)
    Dim Cnt As LatLng
    Cnt.Initialize(IniOwnLat, IniOwnLon)
    
    Dim OwnCnt As MapCircle
    
    If Show=True Then
        OwnCnt=gmap.AddCircle(Cnt,1000,2,fx.Colors.Red,fx.Colors.Magenta,1)
    Else
        gmap.RemoveCircle(OwnCnt)
    End If
End Sub

Also, Is it possible to fill the circle with semi-transparent color, instead of fully transparent or fully opace ?

Thanks
 

EnriqueGonzalez

Well-Known Member
Licensed User
Longtime User
Everytime you dim a variable it will become uninitialized.

OwnCnt should be put in global variables, if you have many, it would be good to save them in a list, You can test wheter the circle is initialized with ownCnt.isInitialized.
 
Upvote 0

Pedro Caldeira

Active Member
Licensed User
Longtime User
That Worked like a charm. Thanks.
And now, just another question.
I get the lat and long outside the circle, but i can get it inside. Is there a way to intercept events inside the circles ?
 
Upvote 0

EnriqueGonzalez

Well-Known Member
Licensed User
Longtime User
I am not very familiarized with this library but you actually use

B4X:
private Sub EventName_CircleClick (SelectedCircle As MapCircle)
  
End Sub
 
Upvote 0
Top