using Google Map API with AppFurnace - part 1
The AppFurnace Map objects use the Google Maps API, but for some reason they have been wrapped in a way that doesn't allow any further configuration of the Google Map. It is not possible to configure an AppFurnace map to allow the user to drop markers....
... but we need this functionality (as described in this post about the portable versions of Hermes) - so I developed a technique.
Here's the technique step-by-step
- create AppFurnace IFrame
- name the IFrame element
- direct the IFrame to load an HTML file which uses the google map API
- configure the google map API to allow the user to drop markers
- interrogate the google map API frame
- create AppFurnace Geo elements at co-ordinates indicated by the google map markers
First set up an AppFurnace screen called 'index' and configure this code to run when it is shown.
AppFurnace IFrame objects create HTML DIV elements with IFrame elements inside. Unfortunately frame.setSrc() doesn't allow the developer to specify the name attribute or id attribute for the DIV element, nor does it add these to the inner IFrame element. They just look like this:
Without named elements, it will be extremely difficult to determine the co-ordinates of any markers that the user has dropped... The solution is to use a rejig function to create a (named) DIV and poke our own (named) IFrame inside such that the result looks like this:
The AppFurnace code to accomplish this is defined in 'rejigTheFrame' below: