Documentation
Solutions
GUIKit
Building GUIs
Deployment
There are a number of features of the GUIKit framework that aid deployment of user interface definitions with your own AddOns so that they can be easily executed when needed. Instead of programmatically building up an expression that represents a user interface and calling GUIRun or GUIRunModal dynamically, there is also a filesystem directory within every AddOn where user interface definitions will automatically be discovered. Any definitions placed within a subdirectory folder of an AddOn named "GUI/" can be loaded with a relative pathname beginning with the path within the "GUI/" directory. This follows the similar convention of Java classes and jars being discovered by J/Link for files located within the "Java/" subdirectory of an AddOn.
Upon startup of the GUIKit` package all AddOns are checked for a "GUI/" subdirectory and these paths are combined into a stored path list as $GUIPath. This path list is used when loading user interface definitions from the filesystem.
In[1]:=
This path list is generated on startup of the GUIKit` package by finding all "GUI/" subdirectories in all AddOns.
In[2]:=
Out[2]=
The relative path "Wolfram/Example/Calculator" is all that is needed to load a file located at "SomeAddOn/GUI/Wolfram/Example/Calculator.xml"
In[3]:=
Out[3]=
GUIKit definitions can be stored on the filesystem and used in either the XML format, GUIKitXML, using an .xml extension, or the Mathematica expression format using a .m extension. The possible extension of a user interface definition can be excluded when specifying its relative pathname. First, a file with the given relative pathname and extension ".xml" is searched for, followed by a file with extension ".m" if an XML version is not found. This allows you to freely mix XML and Mathematica definitions when defining interfaces. One implementation detail is that all interface definitions at runtime are converted to the XML form when created so there is some minor benefit of deploying your final AddOn interface definitions in the XML representation. You do not however have to recreate the XML version of your expressions by hand, but can simply use Export["file.xml", expr, "GUIKitXML"] to let the GUIKit system create the equivalent XML definition for you, since it automatically registers a "GUIKitXML" format with Import and Export when the GUIKit` package is loaded.