UIL: what's available and how to use it
A UIL file
A UIL file is a set of descriptions of a static user interface. It specifies what user interface component is to be placed where on the screen. It consists of the following sections:
module my_ui
end module;
value sample_string : "this is a string"; sample_integer : 10;
there could also be certain global constants, depending on the object in which the value is to be used.
procedure quit();
parameters can be any UIL type (see later section)
object push : XmPushButton {
arguments {
XmNlabelString = "Push";
XmNfontList = font('-adobe-helvetica-medium-r-*-*-*-140-*');
};
callbacks {
XmNactivateCallback = procedure quit();
};
};
UIL Object types
Only some of the more common elements are listed here. These should be adequate for most purposes.
XmBulletinBoard: A container that allows children to be places at arbitrary x,y positions.
XmDrawingArea: A canvas for arbitrary graphics and mouse input
XmMessageBox: a standard dialog with a message, and OK and Cancel buttons
XmFrame: draw a rectangle around its single component
XmLabel: a simple text string
XmList: provides a list of choices from which the suer can select one or (optionally) several items
XmMainWindow: contains a menu bar, a command window, a work region, a message window and scrolling
XmRowColumn: a container that orders its components vertically, or (optionally) horizontally
XmPromptDialog: a dialog that prompts the user for a text string
XmPushButton: a labeled button
XmTextField: a text editor for single line input
XmToggleButton: an on/off switch
UIL data types
Used for values of variables or for object resources (see below). Only some are listed here. Mostly they correpsond to types in C:
any: used to suppress type checking (like void *)
boolean: true/false
color: e.g. color('red'), color('blue')
float: basically a double length number
integer: 32 bit signed integer
string: basically a char * string
widget: all objects defined in the object section are of type widget--sometimes these need to be parameters in declared procedures
Object properties
Each type of object has a number of properties (called resources) that can be set in the UIL description. Some of these are mandatory, but moslty there are defaults that give reasonable results. Each resource is listed by name, together with a type and the default value. If the default value is ?, this resource must be set. Every widget has the follwing resources that can be set:
XmNresizePolicy:unsigned char:XmRESIZE_ANY (could be XmRESIZE_NONE)
XmNheight:integer:?
XmNWidth:integer:?
XmNx:integer:?
XmNy:integer:?
XmNbackground:color:?
XmBulletinBoard:
XmNdialogTitle:XmString:NULL
XmNnoResize:Boolean:False
XmDrawingArea:
XmNexposeCallback:list of procedures for exposure
XmNinputCallback:list of procedures used for key or mouse events
XmMessageBox:
XmNmessageString:string:""
XmNcancelCallback:procedure called when the cancel button is pressed
XmNokCallback:procedure called when the ok button is pressed
XmFrame:
XmNshadowType:unsigned char: ? (could be XmSHADOW_IN, XmSHADOW_OUT, XmSHADOW_ETCHED_IN, XmSHADOW_ETCHED_OUT)
XmLabel:
XmNlabelString:string:?
XmNalignment:integer:? (could be XmALIGNMENT_BEGINNING,
XmALIGNMENT_CENTER, XmALIGNMENT_END)
XmList:
XmNvisibleItemCount:integer:? number of items displayed in the list box
XmNsingleSelectionCallback:procedure called when an item is selected
XmMainWindow:
XmNmenuBar:integer: the widget ID of the menu object
XmNmessageWindow:integer: the widget ID of the message object
XmRowColumn:
XmNorientation:integer: ? (could be XmVERTICAL or XmHORIZONTAL)
XmPromptDialog:
XmNlistLabelString:string:NULL
XmlistVisibleItemCount:integer:0
XmPushButton:
(the text used in the button is the object name)
XmNactivateCallback:procedure called when the button is pushed
XmTextField:
XmNeditMode:integer:XmSINGLE_LINE_EDIT (could be XmMULTI_LINE_EDIT)
XmNvalue:string:""
XmNcolumns:integer:20
XmNrows:integer:1
XmNvalueChangedCallback:procedure called when the text changes
XmToggleButton:
(the button is labeled with the object name)
XmNset:boolean:false
XmNvalueChangedCallback:procedure called when the button changes state