Problem with mergMKAnnotationDropped

This is the place to get technical support and discuss all things to do with MergEXT

Moderators: Klaus, FourthWorld, heatherlaine, robinmiller, monte

Post Reply
GoneToSail
Posts: 31
Joined: Sun Jan 24, 2010 10:34 pm

Problem with mergMKAnnotationDropped

Post by GoneToSail » Thu Nov 29, 2018 9:55 am

Hi,
I would like to display a few waypoints on a map, some of them being draggable. The map does not cover the whole screen of the mobile and there are a few controls above the map rectangle.
Everything works fine as long as I don't move any waypoint, I can show or hide the map as desired. However if I move one waypoint, the controls related to the map or the waypoints are still working, but the rest of the screen seems to be frozen and any control becomes disabled.

I've been unable to attach a stack to this post, but I can describe it as follows:
One card only, with one btn "showHideMap" and one field "Waypoints".
Script of btn "showHideMap":

Code: Select all

on mouseUp
   if the environment is not "mobile" then exit mouseUp
   switch   
      case  the label of me is "Show Map"
         showMap
         wait 10 ticks
         showWaypoints
         set the label of me to "Hide Map"
         break
      default
         hideMap
         hideWaypoints
         set the label of me to "Show Map"
   end switch
end mouseUp
Script of cd "Map"

Code: Select all

local tMapCreated,tAnnotationID

on preOpenCard
   if the environment is mobile then
      set the loc of btn "showHideMap" to item 3 of the screenRect/2,item 2 of the loc of btn "showHideMap"
      set the loc of fld "Waypoints" to item 3 of the screenRect/2,item 2 of the loc of fld "Waypoints"
   end if
end preOpenCard
   
on showMap
   if tMapCreated is true then mergMKSet "visible",true else createMap
end showMap

on createMap
   put "47,-2" into pMapCenter
   put "850000,850000" into pRegion
   mergMKCreate
   mergMKSet "rect",(0,the bottom of btn "showHideMap"+26,item 3 of the screenRect ,item 4 of the screenRect)
   mergMKSet "map type",satellite
   mergMKSet "zoom enabled",true
   -- Earlier versions only ? It seems to be ESSENTIAL that the "region" is set before the "center coordinate"
   mergMKSet "region",pRegion
   mergMKSet "center coordinate",item 1 of pMapCenter &","& item 2 of pMapCenter
   mergMKSet "shows user location",false
   wait 10 ticks
   mergMKSet "visible",true
   put true into tMapCreated
end createMap

on hideMap
   mergMKSet "visible",false
end hideMap

on showWaypoints
   set the itemDel to tab
   repeat with i=1 to the number of lines of fld "Waypoints"
      put item 1 of line i of fld "Waypoints" &","&  item 2 of line i of fld "Waypoints" into pLoc
      put "Waypoint"&&i into pTitle
      if item 3 of line i of fld "Waypoints"=0 then put false into pDragPty else put true into pDragPty
      put item 4 of line i of fld "Waypoints" into pPinColor
      put mergMKAddAnnotation(pLoc,pTitle," ","true","false",pPinColor,pDragPty,,"true") into line i of tAnnotationID
   end repeat
end showWaypoints

on hideWaypoints
   repeat with i=1 to the number of lines of tAnnotationID
      mergMKDeleteAnnotation line i of tAnnotationID
   end repeat
   put empty into tAnnotationID
end hideWaypoints
Content of fld "Waypoints"
  • 46 -2 0 red
    48.5 -5.5 1 green
    50 0 0 red
The red pins are fixed and the green pin is draggable.
Is there anything wrong in my card script, is this a bug, is there any workaround ?
Thanks for any assistance !

I am currently using LC Business 8.1.7 and cannot use a more recent version due to a rather old Mac running MacOSX 10.11.6 and XCode 8.2.1

Post Reply

Return to “MergEXT”