openXPS : The 'hello' GUI tutorial

Making graphics: the OnX program

OnX is a package to handle interactivity (GUI, scripting, visualization). This package permits to create graphical user interface (GUI) from an XML description deposited in ".onx" files. From the .onx files, OnX creates a GUI by using the toolkit provided by Win32. The comportments ("callbacks") of the GUI components (button,...) are scripted by using various interpreters like Python, java, CINT, Tcl or the simple "DLD" default one. The callback scripts are deposited in the .onx files when a GUI "component" is described. OnX provides also high level graphic by supporting Open Inventor viewers and scripting API (Python, java, Tcl) to Inventor. With all that, from an XML description, OnX permits to build an active GUI with 2D/3D graphics in a very flexible way.

The OnX (XML) menu code

The simplest possible application is the usual 'Hello' tutorial. The GUI is coded as follows: This is the only file type OnX can open immediately (the call is simply 'OnX'). It describes the graphical look of the window to be opened and referenced the file File.onx that creates the menu system.

A two item menu 'File' is produced, where the two menu items produce the same effect: print out the greeting 'Hello World'. The real action is in the < activate exec="DLD"> and < activate exec="Python"> tags, respectively: the corresponding interpreters are invoked and the needed parameters provided.

Sample code (the callback routines)

The two menu items listed above will be realized as shown below. and

Data structures and handling

Other sample codes

One of the best ways of learning openXPS is looking at sample code. There are the samples and demos directories in the distribution, and the following provides further useful code to look at.