Microsoft Office Tutorials and References
In Depth Information
Figure 2-59. Interacting with the VWA web part and the drawing using the JavaScript Mashup API
Now that you have successfully created a simple Javascript mashup with a Visio diagram, try to understand the
code. one of the major reasons Javascript was chosen to build the api is because of its simplicity.
Understanding the assets.js Code
First you need to get to the application object and create the event handler for the application load:
Once the application loads, you get the instance of the Visio web access from the page and add two more event
handlers: one when the diagram completes loading, and the other when the shape selection is changed. In the life
cycle of these events, the onDiagramComplete event fires first, and onShapeSelectionChanged is the last event.
_visioWebPart= new Vwa.VwaControl("WebPartWPQ2");
_visioWebPart.addHandler("diagramcomplete", onDiagramComplete);
_visioWebPart.addHandler("shapeselectionchanged", onShapeSelectionChanged);
After the diagram loads, all the objects are available and the diagram is rendered to the browser. This means
that the diagram is completely available on the page and you can get to the page-level properties and methods.
For example, you can set the diagram’s current page zoom value percentage:
var _page = _visioWebPart.getActivePage();
Search JabSto ::

Custom Search