How to add a custom command button to the map toolbar

A custom command button can be added to the MapGuide map toolbar on a per-Web Layout basis via Autodesk Infrastructure Studio.
First, open the Web Layout editor for the map to which you want to add the button. Then, under "New Commands" select the "Add -> Invoke Script" function (make sure that the viewer mode is set to "Edit"). This will add a new, blank command called "Invoke Script" to the New Commands listing.

Under the "Settings" tab, enter the required information. For example, suppose we want to add a command called "Locate Me". Then we could enter the following:
    Command name: Locate Me
    Name to display in the interface: Locate Me
    Tool tip to appear on hover: Locate Me
    Description to appear on the status barLocate Me
    URL to an image for enabled state: ../stdicons/icon_restorecenter.gif
    URL to an image for disabled state: ../stdicons/icon_restorecenter_disabled.gif 
The result will look like this:

Under the "Additional Parameters" tab, you will enter the script under Script to invoke:

The script will be JavaScript that will be executed in the context of the main MapGuide frame. For example:
    alert("Locate Me Custom Command Called from " + window.location.href);
Finally, add the new command to the toolbar under "Toolbar and Menus -> Add Command -> Locate Me":

You may also wish to add a Separator before and/or after this toolbar button. Note that you can move the buttons up and down the list via the arrows.
[Last updated for version 2904 (04/2013)]