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!
4 posts • Page 1 of 1
Hi, I am trying to use the new Map Widget in Livecode Indy 9.0.0. I would like to create a new marker on the map when the user clicks on the map widget for a second (mousedown without moving the mouse). The widget seems not to create any mousedown message, so I thought I need to have an invisible button on top of the map widget, but then I loose the native map navigation (scroll, zoom etc.). Any hints how to solve this? Thanks. Oliver
Hi, I perhaps found a workable solution, see the atttached stack. I placed an invisible button on top of the map widget with follwoing code:
Do you think this is the way to go or are there easier solutions? Thanks. Oliver
Code: Select all
on mousedown local repeatcounter put the mouseloc into tempmouseloc repeat while the mouse is down wait 2 ticks if the mouseloc is not tempmouseloc then pass mousedown put repeatcounter+1 into repeatcounter if repeatcounter > 10 then set the rect of me to the rect of widget "utopia" put the left of me into xmini put the width of me into xmaxi put the top of me into ymini put the height of me into ymaxi put the region of widget "utopia" into tempregion set the itemDelimiter to comma put item 1 of tempregion into latcenter put item 2 of tempregion into loncenter put item 3 of tempregion into latspan put item 4 of tempregion into lonspan put latcenter + latspan/2 into latmini put loncenter - lonspan/2 into lonmini put latcenter - latspan/2 into latmaxi put loncenter + lonspan/2 into lonmaxi put latmaxi-latmini into latdiff put lonmaxi-lonmini into londiff put the mouseh into xposition put the mousev into yposition put (latmini+(yposition-ymini)/ymaxi*latdiff) into currentlat put (lonmini+(xposition-xmini)/xmaxi*londiff) into currentlon ask "name of the marker" if the result is "Cancel" then exit mousedown put the markers of widget "utopia" into tMarkers put currentlat & comma & currentlon into tMarkers [it]["coordinates"] put it into tMarkers[it]["title"] set the markers of widget "utopia" to tMarkers exit repeat end if end repeat end mousedown
- (1.67 KiB) Downloaded 13 times
Thank you for the information on the map widget, OKK. Does anyone know how to have the map go to the My location when the map opens? I know I can set the showsUserLocation, but how do I have the map go to the location of the user when the map opens. I can't seem to find that parameter. Thanks!