A.2 Miscellaneous topics

This section discusses various topics that were omitted from the Guided Tour to keep it simple.

A.2.1 Specifying callback to prolog

Using the background popup of the behaviour editor, the object @prolog (see section 6) can be added to the model. Select Add Send Port to add a new predicate to the @prolog interface. Then type the name of the predicate. Now link the event-port of a control to the predicate and link the arguments.

If the predicate is not defined, select `Edit' on menu of @prolog to start PceEmacs on the source file. Now drag the predicate to the PceEmacs window. This will insert the head of the predicate at the caret. See figure 38

Figure 38 : Specifying Call-back to Prolog

A.2.2 Advanced example of behaviour

Figure 39 is the screen dump of an application and its behaviour model of a tool that shows all files in a directory and clicking on a file shows the file's contents in the editor to the left. It demonstrates various aspects of advanced features for specifying behaviour.

Figure 39 : A file viewer

A.2.3 Specifying conditional actions

Figure 40 shows an example of a conditional activation relation. A conditional relation is created making a connection from the fat dot in the middle of an activation relation to a send-port. Success or failure of the send-port will be interpreted as a condition on the activation relation.

Figure 40 : Conditional activation

A.2.4 Load and save formats

The Dialog Editor provides two load/save formats. The Load, Save, Save As and Save All save and load the status of the dialog editor as an XPCE object using `object->save_in_file'. This format loads quickly, but is rather vulnerable to future changes in the Dialog Editor or any of the graphical classes.

Alternatively, the Dialog Editor can restore itself from the identifier of a dialog/2 clause generated by itself or (slightly) modified. In this case, the layout of the behaviour model will be lost.

We advice to use Save/Load during application development. If, during the maintenance phase of your product it is necessary to modify a dialog, either simply edit the dialog/2 clause, or load both the application and the dialog editor and use Reload From Id to restart the Dialog Editor.