Android Question Do While Loop Puzzle = Solved

Roger Daley

Well-Known Member
Licensed User
Error found in reviewing my post. Asking the quest often provides the answer. Smack forehead.

Hi All,

I have a problem with a Do Whille Loop. Below is the relevant part of the code, assume the variables are defined.

The loop always runs through to the MapZoom being zero when it should exit before this. If I include a msgbox in the loop the loop exits at the appropriate level.
Replacing the msgbox with a Log() doesn't work. Inserting a DoEvents doesn't work. [Clutching at straws]

There other ways of doing this to by pass the puzzle, but understanding what is going on would be useful.

B4X:
    Do While (MinX < LeftMin  OR MinY < TopMin) AND MapZoom > 0
        MapZoom = MapZoom - 1
        cp.Initialize2(MapLat, MapLng, MapZoom, 0, 0 )
        gmap.MoveCamera(cp)
      
        Projection1=GoogleMapsExtras1.GetProjection(gmap)
        MarkerLocation = BTSMarker.Position
        ScreenPosition = Projection1.toScreenLocation(MarkerLocation)
        BTSX = ScreenPosition.X
        BTSY = ScreenPosition.Y
      
        MinX = Min(BTSX,LMX)
        MinY = Min(BTSY,LMY)
        LeftMin = BTSIV.Width
        TopMin = pnlDispLatLng.Height + LMIV.Height      

        Msgbox("Hello", "BTSX")
        'Msgbox(LMX,"LMX")
      
    Loop
Regards Roger
 
Last edited:
Top