how to get "the markers" values of map widget

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: heatherlaine, Klaus, FourthWorld, robinmiller, kevinmiller

Post Reply
drkosta
Posts: 29
Joined: Wed May 22, 2013 8:40 pm
Location: Stuttgart / Germany
Contact:

how to get "the markers" values of map widget

Post by drkosta » Mon Aug 06, 2018 9:38 pm

Hi there,

need some help with the map widget.

What I´ve done so far:

1. Created a map widget.
2. Used a repeat loop for placing several Markes on the map an put some individual Information into to the "title" of each marker. The Information is much longer than the titel field can display in den widget when you click on a marker.

What I need:

When I click on a marker I want to put the information from the title (key: title value: my text) into an text field.

Tried with

Script in Map widget:

Code: Select all

on markerselected pMarkerTag

mymaphandler

end markerselecetd
Stackscript:

Code: Select all

on mymaphandler

put the markers of widget 1 in to field "output"

end mymaphandler
but nothing happens.

How do I get these values stored in "the markers" (tMarkers[x]["title"]) and put it into a new variable or into textfield?

Thanks in advance

Kosta

Klaus
Posts: 10327
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: how to get "the markers" values of map widget

Post by Klaus » Wed Aug 08, 2018 12:23 pm

Hi Kosta,

sorry for being a bit late for the party, "the markers" is an Array, so you need to:

Code: Select all

...
put the markers of widget 1 into tMarkerArray

## Now loop through all KEYS of that array and extract the "titles"
put the keys of tMarkerArray into tKeys

## First collect data into a variable:
repeat for each line tKey in tKeys
  put tMarkerArray[tKey]["title"] & CR after tTitles
end repeat

## Delete trailing CR
delete char -1 of tTitles

## Now display data:
put tTitles into field "output"
...
Best

Klaus

drkosta
Posts: 29
Joined: Wed May 22, 2013 8:40 pm
Location: Stuttgart / Germany
Contact:

Re: how to get "the markers" values of map widget

Post by drkosta » Wed Aug 08, 2018 2:22 pm

Hi Klaus!

Thanks a lot! This did the job :)

Great.

Regards

Kosta

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”