mergMK pin color

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

Moderators: FourthWorld, heatherlaine, Klaus, robinmiller, monte

Post Reply
punchcard
Posts: 19
Joined: Mon Sep 28, 2015 5:41 am
Location: New York, NY, USA

mergMK pin color

Post by punchcard » Sun Oct 11, 2015 12:59 am

I have been successfully using [put mergMKAddAnnotation] to change the colors of some pins. However, if the user touches one of the pins to reveal the name, and leaves the name up, subsequent sending of the same code to change the color of that pin does not work. A suggestion for a workaround will be appreciated.
Last edited by punchcard on Sun Oct 11, 2015 3:38 am, edited 2 times in total.

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am
Location: Bordeaux, France

Re: mergMK pin color

Post by Dixie » Sun Oct 11, 2015 1:07 am

delete the annotation and reissue it with the change of colour...

punchcard
Posts: 19
Joined: Mon Sep 28, 2015 5:41 am
Location: New York, NY, USA

Re: mergMK pin color

Post by punchcard » Sun Oct 11, 2015 2:50 pm

Thank you Dixie, I will try that. Would this approach take away the callout name (something I would like to keep as is, if possible)?

monte
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1564
Joined: Fri Jan 13, 2012 1:47 am
Contact:

Re: mergMK pin color

Post by monte » Thu Oct 15, 2015 1:00 am

When you say you are using mergMKAddAnnotation to change the colors do you mean you are adding a new annotation on top of the existing annotation? My guess is that if it's not working
MapKit has some built in mechanism to maintain the selected pin at a higher layer so that's why it appears to not work while selected.

You should probably use `mergMKAnnotationSet tAnnotationID, "pin color", "green"`, however, that actually removes and adds a new pin behind the scenes because there's no way to update the pins like that unless you are just selecting the annotation in which case there is a way. You could select again after you have set the pin color `mergMKAnnotationSet tAnnotationID, "selected", true` however you will probably get a flash with the callout disappearing and reappearing.
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

punchcard
Posts: 19
Joined: Mon Sep 28, 2015 5:41 am
Location: New York, NY, USA

Re: mergMK pin color

Post by punchcard » Sun Oct 18, 2015 3:38 am

Thank you, monte! Your suggestion worked beautifully like a charm. As you pointed out I was making the mistake of adding annotations on top of each other (which I believe becomes obvious when the shadow of the pin darkens) instead of setting them once and later setting the pin color and selected attributes. Yes, I do get a flash with the callout disappearing and reappearing but in my case it works even better for my needs, bringing attention to the callout.

I have a related follow up question. When I click many many times on the pins and the Current Position blue dot and go back and forth, my buttons and swipe gesture freeze up, however on locationChanged handler keeps on functioning. Doing multiple clicks and double clicks on other parts of the map or outside the map does not cause a freeze. Do you have any suggestions on what might be causing this or what I can do to make it stable?

monte
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1564
Joined: Fri Jan 13, 2012 1:47 am
Contact:

Re: mergMK pin color

Post by monte » Sun Oct 18, 2015 6:21 am

I'm not sure. Sometimes LiveCode gets a bit confused about touches and calling mobileClearTouches can resolve it.
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

punchcard
Posts: 19
Joined: Mon Sep 28, 2015 5:41 am
Location: New York, NY, USA

Re: mergMK pin color

Post by punchcard » Mon Oct 26, 2015 5:15 am

I appreciate the tip Monte, I can see that this helps. I will keep it handy and use it when there is the potential for too many lagging touches.

Post Reply

Return to “MergEXT”