Page 1 of 1

how to get "the markers" values of map widget

Posted: Mon Aug 06, 2018 9:38 pm
by drkosta
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

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

Posted: Wed Aug 08, 2018 12:23 pm
by Klaus
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

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

Posted: Wed Aug 08, 2018 2:22 pm
by drkosta
Hi Klaus!

Thanks a lot! This did the job :)

Great.

Regards

Kosta