Contents | IndexInteractions Between Frames

Interactions Between Frames

Calling the Viewer API from the Task Pane

MapGuide Viewer API
The MapGuide Viewer API is a set of JavaScript
functions used to control the Viewer. Many of the Viewer frames
contain embedded JavaScript functions that can be called from other
locations. For full details about the available functions, refer
to the online MapGuide Viewer API Reference.
To execute any of
the Viewer API functions, call them from JavaScript embedded in
a page. There are three common techniques for this:
- Execute the JavaScript call when the MapGuide page
loads in the task pane. You can perfom all the necessary processing
in advance of loading the page, then emit a function containing
the correct parameters. Use this technique when you want the Viewer
to change when the page loads.
- Execute the JavaScript inside the script
frame. Use this technique when you want the Viewer to change as
a result of an action in the MapGuide page, without reloading
the page.
- Call the Viewer API during client-side interaction
with the page or using the Invoke Script command type in the web
layout. Use this technique when you want to call the API directly
from the tool bar.
NoteIt
is important to know the relationships between the frames. Pages
in the task area must refer to parent.parent.mapFrame in
order to traverse the frame hierarchy properly. However, if the
same function executes from the script frame or the task bar, it
only needs to refer to parent.mapFrame, because
the script frame and the map frame are part of the same frame set.
Many Viewer API calls
will generate requests to the site server, either to refresh data
in the Viewer or to notify the site server of a change in Viewer state.
These requests are generated automatically.