Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 4 of 4 total
Thread Get Location index of icon touched
Wed, Dec 6 2017 7:39 PMPermanent Link

KimHJ

Comca Systems, Inc

I have a Map with several location markers, since this app runs on a phone/tablet I can not display the title since it only works on mouse hover.

There is an OnClick event for TMapLocation, but I can not find a way to retrieve the index of the location.

In the OnClick Event of the Location I tried this but that gives an error :

     i := Map1.Locations.Index;
     ShowMessage(Map1.Locations[i].Title);

Thanks,
Kim
Thu, Dec 7 2017 12:59 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Kim,

<< There is an OnClick event for TMapLocation, but I can not find a way to retrieve the index of the location.

In the OnClick Event of the Location I tried this but that gives an error :

     i := Map1.Locations.Index;
     ShowMessage(Map1.Locations[i].Title); >>

From the TMapLocation.OnClick event handler, just use the Sender parameter:

     ShowMessage(TMapLocation(Sender).Title);

Also, yes, there is an Index property, but it's in the TMapLocation class, not the TMapLocations class (where you're trying to access it).  The TMapLocations class doesn't have any concept of a "current index".

Tim Young
Elevate Software
www.elevatesoft.com
Thu, Dec 7 2017 4:04 PMPermanent Link

KimHJ

Comca Systems, Inc

Tim Young [Elevate Software] wrote:

>>From the TMapLocation.OnClick event handler, just use the Sender parameter:

     ShowMessage(TMapLocation(Sender).Title);

Also, yes, there is an Index property, but it's in the TMapLocation class, not the TMapLocations class (where you're trying to access it).  The TMapLocations class doesn't have any concept of a "current index". <<

Thanks,
I was trying Sender As and that didn't work.

Kim
Fri, Dec 8 2017 2:45 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Kim,

<< I was trying Sender As and that didn't work. >>

I'll see about working that in to the compiler.  I originally left it out because it simply involves a wrapper function around an "is" test followed by a direct cast, and I was trying to keep the amount of "translated" code to a minimum (for easier debugging in the browser).

Tim Young
Elevate Software
www.elevatesoft.com
Image