XVisual Interface Builder (XIB) Version 1.0.7 BETA

This document describes the operation of the XIB (version 1.0.7 BETA) and how you can use it to build X-Window applications.

What is XIB

XIB allows you to visually lay out widgets in an X-Window application, and then to generate the code required to make a stand-alone application. XIB lets you edit widget callback and Event functions and compile these along with the visual components (forms). XIB also lets you edit and compile seperate code blocks called 'modules'. Forms and Modules may be grouped into 'Projects' to be saved, loaded and compiled together.

Starting XIB

It is probably best to make an entry for the XIB (program name xvis) in your window manager's setup file. You can run the XIB from an x-term command line by typing 'xvis &'.

XIB does not create it's own colourmap, so if you have an application such as Netscape running which uses large chunks of the default map, you may find that the number of colours available for the XIB's display is limited somewhat so it's probably a good idea to close large colourmap- greedy applications!

Display components of the XIB

XIB uses several windows to display and/or edit information. Some, such as the colour selection and font selection windows are transient in nature, but some windows remain visible at all times (unless you switch them off!).


XIB Control Window

The control window lets you load and save development files, compile the final application and control the display of other windows. Most functions may be controlled from the pull-down menus, but a few are also available from the button-bar as shown above.

File Menu

Options are:

Object Menu

Options are:

Generate Menu

Options are:

Window Menu

This menu simply enables or disables the display of the main XIB windows. An 'x' checkmark indicates that the window is currently active.


XIB Tools Window

Here you can select which object type you are going to work with. Clicking on a tool other than the pointer, and then clicking inside a form will create a new object of that type. The pointer tool is used to allow manipulation of existing objects without accidently creating a new object which could occur if an object type was selected.

Box tools manage their own children, so you could, for example group a set of buttons inside a box, then the entire group could be moved around simply by moving the box. Boxes have their own agenda when it comes to child positioning and you should be careful how you lay out the children in boxes. If you require finer control, use a form tool.

Form tools allow the same control over it's children's positioning as does the window-form (windows use forms in fact...).

Deleting a box or form will delete all of it's children (see below about how to delete objects).

If a form or box is set hidden or disabled, all of it's children are set the same.


XIB Events Window

When you have selected or created an object, you can indicate which events you want to be recognised by that object by simply selecting the event type. Each event button toggles on and off so you can switch off an event if you wish (the XIB will warn you if any code is attached to that event). Note that events are additional to any callbacks that objects respond to.

XIB Properties Window

The properties window lets you set the resources of the currently selected object (which is indicated in the 'Object Identity' box. Simply select the property you wish to edit in the resource (left- hand-side) list. Depending on the type of resource, the edit window or edit button will be active just above the parameter list. For editable values, simply change the value and press RETURN to register the change. For resources which display a 'change' button, press the button to display the property change tool for that resource. Resources which have their own property change tool (and thus display a 'change' button) are: Fonts, Colours, Paths, Bitmaps, Icons and object references (used by toggles).

As of version 1.0.6-BETA, you may also now click in the RIGHT-hand list (the parameter values) and the CHANGE function will be involked automatically. For numeric or text values, the cursor is moved to the text box and the text is highlighted. If you press a key, the text is cleared ready to receive new data. If, however, you click the left mouse button, the original text is preserved.


XIB Project Member Window

This window maintains a list of the current forms and modules loaded in memory. If you set a New Project from the Control window's File menu, all members of this list are included in the project's scope. The Open and Delete buttons are used to control the display and deletion of code modules. Deleting a module will remove it from memory and this list (but not from disk if it has been saved previously).

Creating applications using the XIB

When you create an instance of an object in a window, you may then change it's properties. To select another object, simply point to it and click. The property list will change to reflect the properties of the new object.

Clicking on an object with the LEFT mouse button displays the object move/size tool. This tool has 6 grips: the corner grips perform a constrained size change on the object, whilst the middle buttons allow the object to be moved around the form. Note that moving the pointer off the window will cause the tool to 'drop' the object at the edge of the window.

Every form can have a placement grid displayed on it to aid positioning of objects within it. The operation and display of the grid are controlled in the OBJECT menu in the Control Window. When "Snap to Grid" is in effect, objects will be positioned on a grid point.

Clicking on an object with the RIGHT mouse button will display a pop-up menu which allows you to perform one of the following operations:

NOTE that there are certain objects which require care when handling. Box and panner objects will initially appear very small and need to be resized. A Box object will resize itself when a child is created inside it. When you want to re-size or move a Box or form which has children, use the RIGHT mouse button and select the Resize/Move option, or make sure you have the pointer tool selected and click the edge of the box or form with the LEFT button.


Code generation

Clicking on the codegen icon, or selecting the Generate Code option in the Generate menu starts the codegen process. If anything needs to be saved, the XIB will alert you to this so you can opt to save all the currently loaded components.

Next, the Code Gen dialog will appear and you can select how the system should generate the code. If a project name has been set, the application name will reflect this, otherwise 'noname' is used. You can enable or disable the generation of a Makefile if you wish. Situations where you may not want XIB to generate a Makefile are for example when you may have edited a previously generated makefile.

The name of the Makefile can be changed if you prefer. This defaults to Makefile. but may be changed as desired.

Clicking 'Generate' will allow the XIB to generate the source code, and to start compiling the application. XIB displays the progress of the compilation, and will display a dialog on completion indicating the success or otherwise of the operation. All the information is then copied to the 'Errors' window for inspection. Your application is now in the working directory and ready to run!.


XIB Programming Tips.

In addition to generating the code needed to construct your application, XIB also generates some extra program elements which may proove useful to you. These include an application exit function call and some global system variables containing information collected during application initialisation.

You should not attempt to re-declare these reserved function and variable names, although you could override the application exit function to perform come actions required by your own application.

Function to Exit an application

You can call the appExit() function to cause the application to close all of it's windows and exit. XIB generates a context service event main loop with system variable _appExit. When this becomes TRUE, the application will leave the loop and close all current windows before exiting entirely. Note that this will also call the user's custom close procedure (see below).

System Variables

Misc. System functions

These are primarily intended for internal use, but may proove convenient to you.

Note that these dummy functions have the correct parameter list for the type of call that they service.

Custom Init and Close procedures - VERSION 1.0.7 upwards

If you create a module called Custom.cc (or custom.cc) then the XIB will expect to find two user-defined functions; appCustomInit and appCustomClose. These allow you to perform Init and Closedown operations that you yourself define. These functions are expected to conform to these specs:-


Return to the XVisual Homepage


Steve Carrie. steve@phoenix.bim.napier.ac.uk

Last Update 07/06/96 at 10:30 hrs