From SeedCode Documentation

GoMaps: Popovers

What's a popover?

Popovers are the sprites that come up when you click on a pin in the map:

How can I change what appears on the map's popovers?

This is done in the GoMaps file itself, on one of the Setup layouts. Navigate to "Setup" using the layout menu or from the "Settings" button on the home screen...

...and select "Popover" from the tabs in the upper right. There you'll be able to change the field mapping and field labels on the popover.

Field Mapping

By manipulating the fields on this Popover Setup layout you can change which fields show up the map popover: changing not just the fields, but their labels as well.

Before you get started, note that every field and label on this layout has a object name. The object name of the selected object below is "DataOption1"...

...and without these names, none of this works. So the work you'll do editing this layout is in renaming and repointing the fields and field labels already on the layout, rather than adding new objects to the layout. You won't change the object names themselves but will point the fields to new fields and change the text of the labels.

To change a field, just double click on one of the existing fields and select a new field from your properties table. To use a related field, create a calc for it in properties.
To change a label, select an existing label and change the text in layout mode.
To get rid of a field, just delete it (and its label) from the layout.

Using a completely custom display

If field mapping won't let you get the popover display the way you'd like it, you can bypass that completely and write your own html for the popover, including fields from your properties table as you see fit.

To do this, edit the script "Compile Map Data" in GoMaps and find the last line where we edit the field "Properties::gm_MapData". Inside that calc you'll see a comment "HTML content for popup...": edit the html that follows and then run the script "Compile Map Data And Settings" to see your change take effect.

Creating custom html for your popovers is best done by folks who are familiar editing html and javascript. SeedCode offers implementation packages to help with this if you get stuck.

Can I add my own links or changes the scripts the current links run?

GoMaps ships with two links at the bottom of the popover: "View Record" and "Get Directions." Both links run FileMaker scripts and you can configure these (change their names, call new scripts, and add your own scripts) by editing the script "Compile Map Data".

Find the comment "Button Links" in that script and edit the next SetVariable line. You'll see each button called out in html with a FileMaker script associated with it. Here is what "View Record" looks like:

//View a record
"<a href=\"fmp://$/<<fileName>>?script=ViewPropertyRecord (propertyID)&param=" & SC_EncodeEntities ($sc_propertyRecordID) & "\"" & sc_isHostedCheck & ">View Record</a>"

You'll see a third entry that you can use as the basis for your own link, and it also helps decode the link syntax for you: there is placeholder text in there for "YourScriptName", "ParametersGoHere", and "Link Displays As This".

Change those three values to your liking and you'll have your own link.

Just be sure to run the script "Compile Map Data and Settings" when you're done to see your changes in the map.

How do I specify an image for my property?

Images are in a separate table (media) related to the properties table. The thumbnail of the first related media record is used in the map popover.

What if I don't have an image?

If only some of your records have images, GoMaps will show a "no image" slide for the ones missing images. You can change the placeholder image used by altering the "Default Property Image" in Setup (navigate to the Setup layout in FileMaker Pro, before distributing the mobile file to your users).

If none of your records will have photos, just delete this placeholder image and GoMaps won't attempt to show it. (Another way to remove images from then popover is to comment out the line setting our $sc_ImageURL variable in the script "Compile Map Data" in GoMaps' mobile file.

When / Where are thumbnails created?

On the hosted side, the field Media::Thumbnail is set to an auto-enter calc, so thumbnails are created for you automatically as Media records are populated with images. Change the definition of this auto-enter calc to change the thumbnail size.

On mobile, the field Media::Thumbnail is set using a script trigger upon modification of the Media::MediaContainer field. The script used in the GoMaps mobile file is called "Process Image..." and you can edit the parameter coming into that script to make you thumbnails larger or smaller.

Note that thumbnails are synced DOWN to the mobile GoMaps file (so you don't have to build them on iPad if we already have them on the server) but not synced up to the hosted file: only the MediaContainer field is sent up. And, of course, the auto-enter calc in the hosted file will make that thumbnail as soon as new photos are received.

Thumbnails and sync speed

It is faster to Push your syncs up than to do Round Trips: in Round Trips the iPad's (slower) processor actually makes the thumbnails on the host for new or edited Media records. In a Push, the iPad drops off the MediaContainer and then disconnects: it's a server side script that processes the InBox and thus ends up making the thumbnail. More on InBox Processing.

More general notes about speeding up GoZync can be found here.

Retrieved from http://archive.seedcode.com/pmwiki/index.php?n=GoMaps.Popovers
Page last modified on April 15, 2013, at 01:25 PM