B4J Question googlemaps marker without remove function

bvonlaar

Member
Licensed User
Longtime User
Hello,
actual I´m working on removing changed marker in googlemaps. I work with a map object and a marker object.

Dim MMark as Marker

MMark.remove ...

By writing MMark.remove I got during writing a "Unknown member: remove" message.
For MMark. I get only the Options: IsInitialized, Position, Title. Visible !

Has anyone an idea why remove isn´t offered?

Benedikt
 

DonManfred

Expert
Licensed User
Longtime User
Hmmm...
B4X:
googlemap.removemarker(MMark)
?
 
Upvote 0

bvonlaar

Member
Licensed User
Longtime User
Well, we think we could fix the origin of the problem, but we aren´t able to solve. It seems to be placed in the library itself. In version 1.28 it´s still present, but the method is missing since version 1.50.
See the attached picture.
 

Attachments

  • markerclass.JPG
    markerclass.JPG
    76.9 KB · Views: 319
Upvote 0

bvonlaar

Member
Licensed User
Longtime User
Hmmm...
B4X:
googlemap.removemarker(MMark)
?
Well, I tried also your way, but I got an error message that before use of MMark as Marker I should initialize it. But I found no way how do initialize the object Marker.
Where did you found the method removemarker? In the library discription I didn´t found anything.

Best
Benedikt
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
that before use of MMark as Marker I should initialize it
B4X:
Dim MMark as Marker = gmap.AddMarker(lat,lon)
'
gmap.removemarker(MMark)  to remove the added marker
Where did you found the method removemarker?
I downloaded the library and had a look at the library XML to find references to "marker"...

PD: Honestly i did not used any GoogleMap inside B4J apps so far... Just tried to help here.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
there is RemoveMarke inside
The issue here is that he did not realized that one need to use gmap.AddMarker to get an Initialized Markerobject.
You can´t create one by code only (without using gmap).

My code
B4X:
Dim MMark as Marker = gmap.AddMarker(lat,lon)
is based on the GoogeMaps-Example code
B4X:
Sub gmap_Ready
    btnResetMap.Enabled = True
    btnJumpToEiffel.Enabled = True
    For i = 1 To 10
        Dim m As Marker = gmap.AddMarker(10 * i, 10 * i, "Marker #" & i)
        AttachInfoWindow(m, "Some text " & i)
    Next
End Sub
 
Upvote 0

bvonlaar

Member
Licensed User
Longtime User
My version of google maps for b4j is 1.61View attachment 55059 As you can see, there is RemoveMarke inside.

Well, I think I have 2 problems. When I try to overcome my problems I have different Browser windows open with different threads which belong to set and remove marker.
Also the documentation of jgooglemaps is open. My focus was upon all you find under Marker theme.
When I started the thread I had only the method marker.remove in my focus not googlemaps.removemarker. In Ver 1.28 is marker.remove available in Ver 1.61 not. In the library discription you can see marker.IsInitialized, marker.Position, marker.Remove, marker.Title, marker.Visible.

A lot of threads work with marker.remove. I didn´t talk about googlemap.removemarker. So I was confused about the first answer from DonManfred, because in the member discription of the library googlemap.Removemarker isn´t listed.
 

Attachments

  • ImgRemove.jpg
    ImgRemove.jpg
    48.8 KB · Views: 320
Upvote 0

bvonlaar

Member
Licensed User
Longtime User
The issue here is that he did not realized that one need to use gmap.AddMarker to get an Initialized Markerobject.
You can´t create one by code only (without using gmap).

My code
B4X:
Dim MMark as Marker = gmap.AddMarker(lat,lon)
is based on the GoogeMaps-Example code
B4X:
Sub gmap_Ready
    btnResetMap.Enabled = True
    btnJumpToEiffel.Enabled = True
    For i = 1 To 10
        Dim m As Marker = gmap.AddMarker(10 * i, 10 * i, "Marker #" & i)
        AttachInfoWindow(m, "Some text " & i)
    Next
End Sub

Yes, DonManfred, you are right, I lost of focus that marker object is initialized quite different like other objects. But second, please see my answer to rboek, I don´t understand the differences in the documentation and whether marker.remove and googlemap.removemarker work identical.

But I will now try to handle "removemarker". The first attempts last night failed. ....we never surrender ;-)
 
Upvote 0

bvonlaar

Member
Licensed User
Longtime User
Marker.Remove is no longer available, due to a change in GMapFX API. You should instead use GoogleMap.RemoveMarker.

Thanks for clearing the fact.
But I have strong trouble with "RemoveMarker". In simple structures it works, but in more complex routines until now it fails.

Benedikt
 
Upvote 0

bvonlaar

Member
Licensed User
Longtime User
Thanks for clearing the fact.
But I have strong trouble with "RemoveMarker". In simple structures it works, but in more complex routines until now it fails.

Benedikt

I have to correct my last statement. The error was by myself. I over counted a For...to...Next loop and the last position was set into nothing.

Thanks again
Benedikt
 
Upvote 0
Top