Array Viewer AvPage Usage and Requests

Array Viewer AvPage Usage and Requests

We are using Array Viewer to display and manipulate results that are generated in another application. For our application, the use of AvPages
to create interactive application that uses VBScript to communicate with a COM server for results can provide some very compelling solution. We would welcome enhancements that simplify the creation of pages, especially those that make extensive use of script code.
- Currently you need to press the 'Update' button before navigating away from an AvPage, else all edits are lost
- Make the editing of pages more like an HTML editor. e.g. syntax highlighting, collapsible blocks similar to vs.NET
- It would be helpful if there was a way to modularize script components, for example if script functions could be stored as pure text as objects in the AV hierarchy
- Although it is desirable in many scenarios to have the AvPage embedded in the HDF file it would be desirable to allow a page object to reference an .HTML file that resides external from the HDF file on disk, (but still be rendered internal to the viewer). This would obviate some of the editing difficulties

4 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Thanks for the suggestions!

For those who aren't familiar with how AvPage objects work, they are simply containers for HTML + Script code that can be used to display custom views in the Array Viewer. An example of a file containing an AvPage is /Data/HDF5/SineCompute.h5. The AvPage object in this file displays a graph along with some UI elements that allow the graph data to be dynamically recomputed.

I think most AV users aren't creating AvPage objects because of the problems that Beau has noted. Another issue is that you have to be a fairly knowledgeable about the AV object model, VBScript or JavaScript, and HTML to develop new AvPage codes. And once you have developed the AvPage, there's no real mechanism for re-use of the code (beyond copy and paste).

For IVF 8.1, there are some AV enhancements that should make it easier to create pages. Under the AV install folder, there will be a Templates folder that contains html files that can serve as the basis for various AvPage constructs. For example, slicer.htm can be used to create a "slice&dice" page where a 3d dataset can be viewed from orthogonal sections.

Complementing the Page templates, is a Macro facility in the viewer. Macros contain script code that can be used to load and customize a page template.

The number of macros & templates will be limited in the IVF 8.1 release, but I'm hoping to increase the number over time. Since they exist as external files, I'm hoping that AV users can share interesting macros/templates as well.

It would be useful to develop a facility where macros can be contained within the data file as well, but this will have to be a post-8.1 feature. One thing you could do today is just store the macro in an AvPage object. Then other pages within the file would be able to access the macro code. The only problem would be if the user clicked on the AvPage containing the macro it wouldn't be a valid HTML file.


Thank you for the followup.

In your last paragraph you say that one AvPage can reference a script function that exists in a separate page. This would be organizationally, (code modularization), helpful but it is unclear to me how this works. Could you please post a brief example that illustrates this capability.


I've attached an AV XML file that illustartes what I'm talking about. If you open this in the Viewer you'll see two pages. "Add Script" contains the text: "function Add(x, y) { return x+y; }". The page "Calculator" contains two edit boxes and a "Calculate" button.

When the Calculator page is loaded, script code on the page gets the Add function from the Add Script page and calls eval(). This enables code in the page to call Add() just as if the function was defined in the page itself.


// Get the text of the "Add Script" page.
var oRoot = window.external.Root;
var oPage = oRoot.Pages.Item("Add Script");
var szAddFunction = oPage.Text;

// evaluate the add function.

When the calculate button is pressed the following code calls the Add function to compute the result:


function OnClick()
   var x = new Number(Addend1.value);
   var y = new Number(Addend2.value);
   sum = Add(x, y);
   result.innerText = sum;


Leave a Comment

Please sign in to add a comment. Not a member? Join today