convertbug for label

Put Claude

Active Member
Licensed User
Longtime User
Hi,

MsgBox(Mapview.GetCenter,"GEOPOINT") give me a good text-output like this: 51.224750,5.171563,0 with the decimal points.
But,
Label.Text = Mapview.GetCenter give me a wrong text-output like this:
51224750,5171563,0 without the decimal points, may it be a convertion bug?

Put Claude Belgium
 

warwound

Expert
Licensed User
Longtime User
That looks to me as if the MsgBox is calling the GeoPoint toDoubleString() method and the Label is calling the GeoPoint toString() method.

toDoubleString() returns the decimally formatted location.

toString() returns the location as microdegrees.

In theory the toDoubleString() method should always be called by B4A, here's the source code from the OSMDroid library:

B4X:
   public String toString() {
      //   seems to not get called by B4A
      return getObject().toDoubleString();
   }

See my comment - i must have noticed at some time that the wrong method was being called but never debugged it...

Try changing your code to this and see if it makes any difference:

B4X:
Label.Text = Mapview.GetCenter.toString

Martin.
 
Upvote 0
Top