[Go to CFHT Home Page] Man Pages
Back to Software Index  BORDER=0Manpage Top Level
    XFORM(4) manual page Table of Contents

Name

Xform windows - syntax and usage

Overview

Xform windows can be designed to meet a multitude of applications, uses, and needs. Whatever their design, their purpose is to make input to and communication with the computer easier and less stressful for every user but particularly for the novice user. The ability to use a mouse to move a cursor around a window and click on the desired area to invoke that option and to type a minimal amount of information are the only two computer skills necessary to operate xform windows; the rest should be apparent from the graphic design, assuming the designer has done a good job.

Xform windows are graphic representations of choices for the user. A variety of shapes and options (herein called widgets) are available to the designer in creating an xform window. These include radio buttons, push buttons, check boxes, text edit areas, etc. The size of the finished xform window depends on the size and quantity of the widgets inside and their arrangement within the window.

A par file must be created for each xform window. The par file contains lines explaining the position of each widget within the window as well as the labels and variables necessary to the proper functioning of the window and the programs invoked as a result of the choices selected. The ui routines in the library libui parse the par file and decipher its contents. Action in the form of drawing a window on the screen results.

Par File Structure


Xwindows = { dns, , Off, On }    # X windows form requested
parvarname1 = { , , }            #          variable
parvarname2 = { , , }            #
parvarname3 = { , , }            #        declarations
    :                            #
    :                            #           section
+main level                      #
  +secondary level               #       statements that
    +tertiary level              #
          :                      #      define the window
          :                      #
+invoke...                       #     statement done when
                                 #  the accept push button is
                                 #         selected

The statements that define the layout of a form are par file constant definitions (see cfp(4) for more information). By convention all names used to build a form begin with a plus sign (+) and all tertiary level names begin with the secondary level name. That convention is assumed in all the descriptions and examples below. All of the prefixes given in the main and secondary level definitions can be any strings, but it is easier to read a form definition if one follows the conventions.

a Par File Example


###################################################################
# file: example.par
#
# HISTORY
#
# who            when              what
#------------------------------------------------------------------
# xxx           31 Mar 1989       original
# yyy           11 Apr 1989       added second file
#
###################################################################
Xwindows = { dns, , Off, On }
file1  = { r, current.fits, current.fits }         #
file2  = { r, previous.fits, previous.fits }       #   variable
raw    = { r, False, False }                       #
base   = { r, True, False }                        # declarations
debase = { r, True, True }                         #
bgtype = { r, edge, edge }                         #   section
edge   = { r, 10, 10 }                             #
+form = 0 0 -1 -1 +f  9                            #
  +f0 = TB  0  0  -1  -1  +f0l                     #    form
    +f0l = Look at a Reticon Cut                   #
  +f1 = ST  1  1.5  -1  0  +f1l  -1                # definition
    +f1l = File1:                                  #
  +f2 = TE  1  1  1  0  file1 20                   #  section
  +f3 = ST 1 1.5 -1 1 +f3l -1                      #
    +f3l = File2:                                  #     :
  +f4 = TE 1 1 1 1 file2 20
  +f5 = CB  2  2  -1  4  +f5v  +f5l  3  1
    +f5v0 = raw
    +f5v1 = base
    +f5v2 = debase
    +f5l0 = Show Rawdata
    +f5l1 = Show Baseline
    +f5l2 = Show Debased Rawdata
  +f6 = RB 2 1 -1 5 bgtype +f6l +f6v 0 3 1
    +f6l0 = Edge
    +f6l1 = First and Last Rows
    +f6l2 = First and Last Columns
    +f6v0 = edge
    +f6v1 = rows
    +f6v2 = columns
  +f7 = PB
  +f8 = SR 7 1 2 7 reticon.bm
+invoke = echo %file1 %file2 $raw $base $debase %bgtype %edge

Suggested Steps to Use in Designing an Xform Window

1.
Lay out on paper the necessary widgets. Consider their relative relationships with the other widgets in the window and decide what arrangement best communicates to the novice user the choices to be made. Remember that inserting a widget after the form has been created can be time consuming.
2.
Begin to build the par file sequentially, testing each added step on the computer screen to see if it is visually satisfactory. Always keep in mind that the goal is to communicate as much information as possible with as little clutter as possible. Execution of xform windows without push buttons can be killed by using CTRL-c.
3.
Continue in such a manner until the entire window is assembled and functions as desired.

Note: Changing the number of fields to some low value and incrementing it with each iteration makes a good debug tool.

(You might also try gxe, at least for the first pass.)

Variables

All variables referenced in the form definition must be declared elsewhere in the par file. The CFHT standard places the variables first, the form definitions second, and the help lines last.

Example


file1 = { r, updated.fits, current.fits }

In this example, file1 is the variable being declared, possibly for a TE or LT text value. The r within the braces indicates that the value of file1 can be updated by editing its associated text edit area in the window and selecting either the Accept push button or the Save values push button. The final parameter (current.fits) is the default value; upon selection of the Defaults push button, the value of the variable will revert to its default.

For further information on variables see cfp(4) .

Main Level

What

The main level is the first definition necessary to begin the construction of an xform window. It provides the name for the form. It normally precedes the definitions of all widgets contained in the form. Multiple forms can be defined in the same par file; each is referred to by its name.

Purpose

The main level statement contains information which was intended to define the boundaries of the xform window. However, as currently implemented, the x, y, dx, and dy values described below are ignored. The standard X windows system resource files are used to control window placement. The widgets defined in a form drive the window size. In addition, the main level contains a code that dictates the names of all succeeding secondary levels as well as the total number of secondary levels to expect.

Format

+form = x y dx dy +prefix count

+form
any name (string of characters) desired by the programmer. The default form opened by xform(1) is +form.

x
an integer describing the number of pixels to move in the x (horizontal) direction from the location specified in dx. This value, together with the y value described below, will define one corner of the xform window. If x > 0, then the movement is of the left window edge to the right from the left edge of the desktop (root window); if x < 0, then the movement is of the right window edge to the left from the right edge of the desktop.

y
an integer describing the number of pixels (not characters) to move in the y (vertical) direction from the location specified in dy. If y > 0, then the movement is of the top window edge down from the top of the desktop; if y < 0, then the movement is of the bottom window edge up from the bottom of the desktop.

dx
a real number designating the horizontal position in characters from which the x movement is to be made. -1 is always used and indicates the left or right edge of the desktop. (The use of values other than -1 result in windows that run off the screen.)

dy
a real number designating the vertical position in characters from which the y movement is to be made. -1 is always used and indicates the upper or lower edge of the desktop. (The use of values other than -1 result in windows that run off the screen.)

+prefix
the prefix for the names of this window’s secondary levels.

count
a positive integer indicating the total number of secondary levels that follow.

Example

+form = 0 0 -1 -1 +f 7

This statement would create an xform window with seven contained widgets (secondary levels). The 7 secondary level definitions will all begin with the characters +f, and they will be named +f0, +f1, +f2, ..., +f6.

Secondary Levels

What

The secondary levels indicate the widgets (push buttons, radio buttons, text edit areas, etc.) that are found within the xform window. A secondary level definition is necessary for each widget. Secondary levels are traditionally indented to make their relationship with the other definitions clearer.

Purpose

The secondary levels define the widgets found within the xform window. Their positions are indicated relative to either the outer edge of the xform window itself or other widgets already established within the window. Other information specific to the type of widget is included as required.

Format

+name# = type xoff yoff xref yref varies

+name#
a string of characters composed of the +prefix specified in the main level definition and an integer indicating the current level. Secondary levels are numbered sequentially beginning with 0. If +prefix is +f and count from the main level equals 3, then there must be three secondary levels, and they must be named +f0, +f1, and +f2.

type
two characters that specify the type of widget.


    TB = title bar            PB = standard push buttons
    ST = static text        PI = push button invocation
    TE = text edit            AB = arrow button invocation
    LT = labeled text edit    DB = drawn button invocation
    CB = check boxes        RB = radio buttons
    SL = scrolled list        RM = radio buttons multiple
    SP = separator line        OP = option menu
    SR = static raster        OM = option menu multiple
    BP = background pixmap    SC = scale

xoff
a real number (positive or zero) describing the number of characters to move in the x (horizontal) direction from the location specified in xref. This value, together with the yoff value, will determine the location of the widget’s upper left corner.

yoff
a real number (positive or zero) describing the number of characters (lines) to move in the y (vertical) direction from the location specified in yref.

xref
an integer describing the location from which the xoff movement is to be begin. If xref equals -1, then the xoff movement begins from the lefthand edge of the xform window being created. If xref equals any positive integer less than the current level, then the xoff movement begins from the rightmost edge of the widget drawn in that level. If xref equals any positive integer greater than the current level, then nothing will be drawn (error).

yref
an integer describing the location from which the yoff movement is to be begin. If yref equals -1, then the yoff movement begins from the top edge of the xform window being created. If yref equals any positive integer less than the current level, then the movement begins from the bottom edge of the widget drawn in that level. If yref equals any positive integer greater than the current level, then nothing will be drawn (error).

varies
see the particular widget for further specifications.

Tertiary Levels

The existence of tertiary level lines depends on the widget being defined. Some widgets require tertiary levels; some do not. See the specific widget for further specifications.

Tertiary levels are traditionally indented to make their relationship with the other lines clearer. See the PAR FILE STRUCTURE diagram for elucidation.

Tertiary levels may reference variables that can be shared (if appropriate) with other tertiary levels.

the Widget Title Bar (tb)

What

A title bar is a shaded rectangular region generally placed along the upper edge of an xform window. Centered within the title bar is the title, which can be any text designated. If a window is to have a title bar, it should be defined at the 0 level. In other words, the line immediately following the main level line should be the title bar line.

Purpose

A title bar is to an xform window what a title page is to a book---an area containing a short but descriptive phrase indicative of what happens in it.

Format

+name =TB xoff yoff xref yref +namel

+name, xoff, yoff, xref, and yref are as described above in SECONDARY LEVELS.

+namel
(ell) names the tertiary level line containing the title to be displayed within the title bar.

Example

+f0 = TB 0 0 -1 -1 +f0l
+f0l = Alignment

These statements would create a title bar across the top of the xform window containing the title Alignment centered within the title bar area. The xoff and yoff values of 0 indicate that the title bar should be drawn beginning at the top lefthand corner of the window (-1 -1).

the Widget Static Text (st)

What

The widget static text creates an area with no visible boundary. It contains a descriptor or label that cannot change.

Purpose

A static text area is used to describe options within a window and is often paired with an adjacent text edit window. (See also the labeled text widget (LT) which combines these functions.)

Format

+name =ST xoff yoff xref yref +namel dx

+name, xoff, yoff, xref, and yref are as described above in SECONDARY LEVELS.

+namel
(ell) names the tertiary level line containing the static text (label) to be displayed within the static text area.

dx
an integer designed to support multiple static text lines, allowing the user to size the static text area. This gives the number of characters to reserve for the width of the static text area. -1 or 0 means there is one line, and the area is sized automatically. Any positive value gives the character width of the area. In this case, use @n in the value of +namel to separate the text lines.

Example

+f3 = ST 10 1.5 -1 0 +f3l -1
+f3l = File1:

These statements would create a static text area whose top lefthand corner would be 10 characters from the lefthand edge of the screen and 1.5 characters (lines) down from the bottom edge of the level 0 widget. The string File1: would appear in the static text area which is as large as necessary to accommodate the string shown in the tertiary level.

the Standard Push Buttons (pb)

What

A push button is a outline containing text which briefly describes the action to be invoked upon selecting the button. Push buttons may come in sets of two or more; when they do, the actions they describe are mutually exclusive (that is, only one can be done at a time).

Purpose

Push buttons provide an easy way for the user to choose one of several appropriate actions. Selecting a push button is normally the last thing done at a window; all other options must be indicated prior to the invocation of one of the action push buttons. Once a push button is selected, the action is immediately undertaken, if possible (assuming the user made no errors). No recovery from mistakes is possible.

At CFHT five standard push buttons are used. These are:

Defaults
all options are reset to their default values and the window is not exited.
Save values
all options are satisfactory but the user is not ready to invoke the action of this window yet; the sticky values shown in the window (if appropriate) are saved; the window is closed for now; and the xform program exits.
Cancel
no values are saved; the window is closed; and the xform program exits.
Accept
all options are satisfactory; the values shown in the window (if appropriate) are saved; the action of this window, if any, is invoked; the window is closed; and depending on the program invoked there may be feedback to the user.
Help
Display a help message defined by the +HELP_+form definition.
Apply
like Accept except the window remains. The current values are used for the invocation of the window’s action. If the action updates any of those values, they are updated in the window when the action finishes.

Format

+name =PB xoff yoff xref yref +namea +namel num numcol

+name, xoff, yoff, xref, and yref are as described above in SECONDARY LEVELS.

+namea
names the tertiary level lines containing the action to be done when the associated button is pushed. The left button is defined by +namea0, the next button to the right is defined by +namea1, etc. The actions are numeric codes with the following meanings.
0 Defaults
1 Apply
2 Cancel
3 Accept
4 Save Values
5 Help
For example,
+f1a0 =
3
defines the left button to have the
Accept action.

+namel
(ell) indicates the label associated with each button is defined by tertiary level lines named +namel0, +namel1, etc. For example,
+f1l0 =
Accept
labels the left button as the "Accept" button.

num
a positive integer indicating how many push buttons should be displayed.

numcol
a positive integer indicating in how many columns the push buttons should be displayed. If numcol equals 1, then the push buttons will all be aligned in one vertical column. If numcol equals 3, then the push buttons will be aligned in three columns. The standard configuration has num = numcol.

Since the five CFHT push buttons are standardized in appearance and format, the designer has only (optionally) to designate their position within the window being created. With no parameters following PB, the five push buttons will appear in one horizontal row at the bottom of the form. Since the push buttons are the last interaction with a window, the CFHT convention is to place them at the bottom area of a window.

Examples

+f9 = PB

This definition would make the five standard CFHT push buttons appear at the bottom of the form window.

+f9 = PB 0 0 -1 -1 +f9a +f9l 2 2
+f9l0 = Done
+f9a0 = 3
+f9l1 = Help
+f9a1 = 5

These lines would cause two buttons labelled "Done" and "Help" to appear at the bottom of the window. Clicking the "Done" button will cause the "Accept" action (3) to be activated (supply a blank +invoke definition for this form), closing the form. Clicking the "Help" button will cause the "Help" action to be activated.

Note that for a form that does not need to "do anything" when it is closed, use the label "Done" with the action value 3. For a form with an Apply button, use the label "Apply" with the action value 1 and a label "Done" with the action value 2 (yes, for Cancel).

the Widget Push Button Invoke (pi)

What

A push button invoke is a outline containing text which briefly describes the action to be invoked upon selecting the button. The actions described by a group of push buttons are mutually exclusive; only one can be done at a time.

Purpose

Push buttons provide an easy way for the user to choose one of many possible options. Once a push button is selected, the action is immediately taken. With push button invokes, any action can be specified, and the form remains open. There are two types, one intended for buttons that just bring up other forms and the other intended for actions that use the current form values to run a program. The first type does not save the current form values; it just invokes the specified action (in the background). The second type saves the current form values, invokes the specified action (in the foreground) and waits for it to finish while displaying a watch cursor, and updates the current form values before allowing any further interaction with the form. The second type is indicated by the wait parameter.

Format

+name =PI xoff yoff xref yref +namei +namel num numcol largest [wait]

+name, xoff, yoff, xref, and yref are as described above in SECONDARY LEVELS.

+namei
indicates the command to be invoked when the associated push button is clicked is defined by tertiary level lines named +namei0, etc.

+namel
(ell) indicates the label associated with each button is defined by tertiary level lines named +namel0, etc. For example,
+f2l0 =
Say Done
labels the first button as the "Say Done" button.
(To make the label be on two lines, define the value as
+f2l0 =
Say@nDone
, and "Say" will appear centered above "Done".)

num
a positive integer indicating how many push buttons of the invoke type should be displayed.

numcol
a positive integer indicating in how many columns the push buttons should be displayed. If numcol equals 1, then the push buttons will all be aligned in one vertical column. If numcol equals 3, then the push buttons will be aligned in three columns.

largest
This value is not used but must be present; use 0.

wait
This value is optional. For the first type of button, i.e., background, do not use it. For the second type of button, i.e., forground, put a @w@ in for this value.

Example

+f9 = PI 7 2 -1 0 +f9i +f9l 1 1 1
+f9i0 = echo done
+f9l0 = Say Done

These lines would create 1 push button of the invoke variety. It would be displayed (in 1 column) 7 characters to the right of the left edge of the window and 2 characters (lines) down from the level 0 widget. The words Say Done would appear in the button. Upon clicking the push button, the word done would appear on the screen if the form is brought up from the command line.

the Widget Arrow Button Invoke (ab)

What

An arrow button invoke is a outline containing a horizontal or vertical arrow and a command to be invoked upon selection of the button.

Purpose

An arrow button provides a way to execute a command related to horizontal or vertical motion. Once an arrow button is selected, the action is immediately taken. The form remains open.

Format

+name =AB xoff yoff xref yref +namei direction

size

+name, xoff, yoff, xref, and yref are as described above in SECONDARY LEVELS.

+namei
indicates the command to be invoked when the associated arrow button is clicked is defined by a tertiary level line named +namei.

direction
a letter indicating the direction for the arrow. The possible letters are:
u or U arrow pointing up
d or D arrow pointing down
l or L arrow pointing left
r or R arrow pointing right

size
a positive integer indicating the size of the arrow. The actual size of the arrow is size*5+20 pixels. Try one for starters.

Example

+f6 = AB 3 0 5 5 +f6i l 1
+f6i = echo left

These lines would create an arrow button with an arrow pointing left. It would be displayed 3 characters to the right of the level 5 widget. Upon clicking the push button, the word left would appear on the screen if the form is brought up from the command line.

the Widget Drawn Button Invoke (db)

What

A drawn button invoke is a outline containing a picture and a command to be invoked upon selection of the button.

Purpose

On the theory that a picture is worth a thousand words, a drawn button provides for a single push button invoke with a picture label. Once a drawn button is selected, the action is immediately taken. The form remains open.

Format

+name =DB xoff yoff xref yref +namei filename

+name, xoff, yoff, xref, and yref are as described above in SECONDARY LEVELS.

+namei
indicates the command to be invoked when the associated drawn button is clicked is defined by a tertiary level line named +namei.

filename
the name of a file containing a bitmap for the picture on the button (see bitmap(1) ).

Example

+f7 = DB 3 4 5 6 +f7i eye.bm
+f7i = echo eye

These lines would create a drawn button with the picture defined by eye.bm as its label. It would be displayed 3 characters to the right of the level 5 widget and 4 lines below the level 6 widget. Upon clicking the push button, the word eye would appear on the screen if the form is brought up from the command line.

the Widget Check Box (cb)

What

A check box is a small square followed by text describing the option. It acts as an on-off switch. If the square is filled, then the option is activated (on) ; if the square is empty, then the option is not activated (off). The user can toggle the on-off switch by clicking in the square with the mouse.

Purpose

A check box is an easy means of permitting the user to select one of two possible states of an option. One state will be specified as the default and automatically implemented if the user does not specify that the other state is desired by clicking in the check box. Check boxes should be used for one or more boolean values that are not related to other values. See scrolled lists (SL) for a menu based equivalent. See also radio buttons (RB), multiple variable radio buttons (RM), option menus (OP), and multiple variable option menus (OM) for mutually exclusive values.

Format

+name =CB xoff yoff xref yref +namev +namel num numcol

+name, xoff, yoff, xref, and yref are as described above in SECONDARY LEVELS.

+namev
indicates that the variable associated with each check box appearing in the window is defined by tertiary level variable lines named +namev0, +namev1, ..., +namevnum. +namev0 corresponds to the upper left check box, +namev1 corresponds to the next check box to the right (or if none, to the leftmost one in the next row), etc. There must be a variable line and a variable for each of the num check boxes. Thus, if num equals 3, then tertiary levels +namev0, +namev1, and +namev2 must be defined.

+namel
(ell) indicates the label associated with each check box is defined by tertiary level label lines named +namel0, etc. The naming is the same as for variable lines, and there must be a label line for each check box.

num
a positive integer indicating how many check boxes should be displayed.

numcol
a positive integer indicating in how many columns the check boxes should be displayed. If numcol equals 1, then the check boxes will all be aligned in one vertical column. If numcol equals 3, then the check boxes will be aligned in three vertical columns.

Example 1

ready = { dns, , Off, On } # ready to go?
   :

   :

+f26 = CB 3 0.5 -1 18 +f26v +f26l 1 1
+f26l0 = Move carriage ahead of ZPD?
+f26v0 = ready

These lines would generate 1 check box. The check box would be located 3 characters to the right of the left edge of the window and 0.5 characters (lines) down from the bottom of the widget created in level 18. The check box would be labeled Move carriage ahead of ZPD?, and the Boolean variable ready would hold the True or False value indicated by the check box status. However, because dns is specified for the mode of ready, this would only make sense for a program form; the resulting value is never saved to the par file.

Example 2

raw = { r, False, False } # wants raw
base = { r, True, False } # wants base
debase = { r, True, True } # wants debase
       :

       :

+f5 = CB 2 6 -1 4 +f5v +f5l 3 1
+f5v0 = raw
+f5v1 = base
+f5v2 = debase
+f5l0 = Show Rawdata
+f5l1 = Show Baseline
+f5l2 = Show Debased Rawdata

These lines would generate 1 vertical column containing 3 check boxes. The boxes would be located 2 characters to the right of the left edge of the window and 6 characters (lines) below the bottom of the widget created in level 4. The label Show Rawdata would appear to the right of the top check box, the label Show Baseline would appear to the right of the middle check box, and the label Show Debased Rawdata would appear to the right of the bottom check box. The variable raw would hold the value indicated in the top check box, the variable base would hold the value indicated in the middle check box, and the variable debase would hold the value indicated in the bottom check box. Because the variable raw has a current value of False, the top check box will appear empty (not selected; off). Because the variables base and debase both have current values of True, the middle and bottom check boxes will appear filled (selected; on). If the Defaults button is clicked, raw and base would become False, and debase would become True.

the Widget Radio Buttons (rb)

What

A radio button is a circle followed by a descriptive label. If the circle is filled, then the option described is activated (it is on); if the circle is empty, then it is not activated (it is off). The user can control the on-off switch by clicking in the circle with the mouse. Radio buttons must always be used in sets of two or more. Only one radio button in a set can be active at any time. The value associated with the selected item can be any string.

Purpose

A set of radio buttons provide the user with an easy means of selecting one of several options which are mutually exclusive. In other words, if only one of, say, three choices is appropriate, then a set of radio buttons is an easy way to present this option to the user and eliminate potential errors. The name radio buttons comes from the typical car radio with buttons which the user can depress to select one station from amongst five preprogrammed choices. Once one button is depressed (selected), no other can be depressed---just one station can be selected at a time. In the computer window, when one button is filled (selected), then no other is filled (selected).

See option lists (OP) for a menu based way of doing the same thing. See multiple variable radio buttons (RM) for a boolean way of doing a similar thing. See multiple variable option menus (OM) for a pop up menu version of RM.

Format

+name =RB xoff yoff xref yref varname +namel +namev start num numcol

+name, xoff, yoff, xref, and yref are as described above in SECONDARY LEVELS.

varname
a variable name declared in the variable declarations section. The value associated with the selected radio button is stored into this variable. The current value of this variable determines which button is selected initially. The default value of this variable becomes the current value when the Defaults button is pushed.

+namel
(ell) indicates the label associated with each radio button is defined by tertiary level label lines named +namel0, etc. +namel0 corresponds to the upper left radio button, +namel1 corresponds to the next radio button to the right (or if none, to the leftmost one in the next row), etc. There must be a label line for each of the num radio buttons. Thus, if num equals 3, then tertiary levels +namel0, +namel1, and +namel2 must be defined.

+namev
indicates the value associated with each radio button is defined by tertiary level value lines named +namev0, etc. The naming is the same as for label lines, and there must be a value line for each radio button. When a radio button is pushed, its associated value is copied into the variable varname.

start
an integer [0..num-1] originally intended to signify which radio button should be pushed in at start up. However this is now defined by the current value of the varname variable. The only time this is used is if the varname current or default value does not match one of the possibilites given by the +namev levels. Use 0?

num
a positive integer indicating how many radio buttons to display.

numcol
a positive integer indicating the number of columns in which to display the radio buttons. Using this value and the num value, the number of rows will be automatically calculated. If num equals 6 and numcol equals 2, then there would be two columns of three rows each (each containing three radio buttons). If num equals 5 and numcol equals 3, then there would be two columns containing two radio buttons each and one column containing only one radio button.

Example 1

along = { r, x, x } # which axis is selected
   :

   :

+f5 = RB 7 3 -1 0 along +f5l +f5v -1 2 1
+f5l0 = X=1,n
+f5l1 = Y=1,n
+f5v0 = x
+f5v1 = y

These lines would generate 1 column of 2 radio buttons located 7 characters to the right of the left edge of the window and 3 lines below the bottom of the level 0 widget. The top radio button would be labeled X=1,n, and the bottom one would be labeled Y=1,n. Selecting the top radio button would give the variable along the value x, and selecting the bottom button would give the variable along the value y.

Example 2

type = { rd, bias, object } # exposure type
   :

   :

+f8 = RB 2 1 4 7 type +f8l +f8v 0 5 3
+f8l0 = Object
+f8l1 = Comparison
+f8l2 = Flat (continuum)
+f8l3 = Dark
+f8l4 = Readout
+f8v0 = object
+f8v1 = comparison
+f8v2 = flat
+f8v3 = dark
+f8v4 = readout

These lines create 5 radio buttons in 3 columns. The leftmost column is located 2 characters from the rightmost edge of the widget drawn in level 4 and 1 character (line) below the bottom of the widget drawn in level 7. The value object is stored into type if the upper left button is pushed, the value comparison is stored into type if the upper middle button is pushed, the value flat is stored into type if the upper right button is pushed, the value dark is stored into type if the lower left button is pushed, and the value readout is stored into type if the lower "middle" button is pushed. The button labelled Bias will be selected initially. If the Defaults button is pushed, object will be stored into type and the button labelled Object will be selected.

To make radio buttons line up vertically with text entry or labeled text fields, put the text fields about 2.75 units apart vertically and add a @n at the end of the radio button labels.

the Widget Multiple Variable Radio Buttons (rm)

What

To the user multiple variable radio buttons appear to be similar to regular radio buttons (RB) as described above. Internally, however, whereas regular radio buttons put arbitrary values into a single variable, multiple variable radio buttons have one Boolean variable for each button and set one True and the others False.

Purpose

RM radio buttons allow the programmer to select one of a group of mutually exclusive options. See multiple variable option menus (OM) for a pop up menu way of doing the same thing. See check boxes (CB) or scrolled lists (SL) for selecting multiple independent boolean options.

Format

+name =RM xoff yoff xref yref +namev +namel start num numcol

+name, xoff, yoff, xref, and yref are as described above in SECONDARY LEVELS.

+namev
indicates the variable associated with each radio button is defined by tertiary level variable lines named +namev0, etc. +namev0 corresponds to the upper left radio button, +namev1 corresponds to the next radio button to the right (or if none, to the leftmost one in the next row), etc. There must be a variable line for each of the num radio buttons. Thus, if num equals 3, then tertiary levels +namev0, +namev1, and +namev2 must be defined. When a radio button is pushed, its associated variable is set to True and all the other variables associated with the radio button set are set to False.

+namel
(ell) indicates the label associated with each radio button is defined by tertiary level label lines named +namel0, etc. The naming is the same as for variable lines, and there must be a label line for each button.

start
an integer [0..num-1] originally intended to signify which radio button should be pushed in at start up. However this is now defined by the variable values. The only time this is used is if the +namev level variables are all False. Use 0?

num
a positive integer indicating how many radio buttons to display.

numcol
a positive integer indicating the number of columns in which to display the radio buttons. Using this value and the num value, the number of rows will be automatically calculated. If num equals 6 and numcol equals 2, then there would be two columns of three rows each (each containing three radio buttons). If num equals 5 and numcol equals 3, then there would be two columns containing two radio buttons each and one column containing only one radio button.

Example

dummy = { r, Off, On } # filler for Normal
Reset = { r, Off, Off } # clear controller
Status = { r, Off, Off } # show status
   :

   :

+setup7 = RM 4 1 -1 6 +setup7p +setup7l 0 3 1
+setup7p0 = dummy
+setup7p1 = Reset
+setup7p2 = Status
+setup7l0 = Normal
+setup7l1 = Reset and Open Path
+setup7l2 = Read All Devices

These lines would generate 1 column of three radio buttons located 4 characters to the right of the lefthand edge of the window and 1 character (line) below the bottom of the level 6 widget. The top radio button would be labeled Normal, the middle one, Reset and Open Path; and the bottom one, Read All Devices. At start up the Normal button would be selected because all variables are False and start is 0. Selecting one of the buttons would result in the corresponding variable (e.g., Reset) being set to True and the others (e.g., dummy and Status) being set to False. If Defaults is clicked, dummy will be set True and Reset and Status will be set False.

the Widget Option Menu (op)

What

An option menu provides a menu version of radio buttons. It provides a pop up menu containing a list of items, only one of which can be selected at a time. When the menu is not active, the selected item is displayed. When the menu is activated by clicking, a list showing all the items is "popped up" with the selected one highlighted, and a new item can be selected. The value associated with the selected item can be any string.

Purpose

An option menu provides the same functionality as radio buttons without requiring as much screen real estate. However since only the selected item is visible unless the menu is active, the choices are not immediately obvious. See radio buttons (RB) for a visible way of doing the same thing. See multiple variable radio buttons (RM) for a boolean way of doing a similar thing. See multiple variable option menus (OM) for a pop up menu version of RM.

Format

+name =OP xoff yoff xref yref index varname +namet +namev +namel default num

+name, xoff, yoff, xref, and yref are as described above in SECONDARY LEVELS.

index
a variable name declared in the variable declarations section. The index of the selected menu item (zero based, i.e., [0..num-1]) is stored in this variable’s current value. The current value determines which item is selected initially.

varname
a variable name declared in the variable declarations section. The value associated with the selected menu item is stored into this variable.

+namet
indicates that the title to be displayed to the left of the menu is defined by a tertiary line named +namet.

+namev
indicates the value associated with each menu item is defined by tertiary level value lines named +namev0, etc. +namev0 corresponds to the top menu item, +namev1 corresponds to the second menu item, etc. There must be a value line for each of the num menu items. Thus, if num equals 3, then tertiary levels +namev0, +namev1, and +namev2 must be defined. When a menu item is selected, its associated value is copied into the variable varname. Note that the label and value fields are switched compared to the radio button definition.

+namel
(ell) indicates the label for each menu item is defined by tertiary level label lines named +namel0, etc. The naming is the same as for value lines, and there must be a label line for each menu item. Note that the label and value fields are switched compared to the radio button definition.

default
an integer [0..num-1]. This value selects the item chosen when the Defaults button is pushed.

num
a positive integer indicating how many items are in the list. This many value and label tertiary lines must be defined.

Example

along = { r, x } # which axis is selected
index = { r, 0 } # menu index of chosen axis
   :

   :

+f5 = OP 1 1 -1 4 index along +f5t +f5v +f5l 0 2
+f5t = Axis of cut
+f5l0 = X=1,n
+f5l1 = Y=1,n
+f5v0 = x
+f5v1 = y

These lines would generate a pop up menu located 1 character to the right of the left edge of the window and 1 line below the bottom of the level 4 widget. The title to the left of the menu would be Axis of cut. The initial value displayed in the menu window would be X=1,n. Upon clicking on the menu, a two item pop up menu would appear with X=1,n on top and highlighted, and Y=1,n would be the other menu item. If Y=1,n is selected, the current value of along will become y, and the current value of index will become 1. If Defaults is selected, the current value of along will become x, and the current value of index will become 0.

the Widget Multiple Variable Option Menu (om)

What

A multiple variable option menu provides a menu version of multiple variable radio buttons. To the user multiple variable option menus appear to be similar to regular option menus (OP) as described above. Internally, however, whereas regular option menus put arbitrary values into a single variable, multiple variable option menus have one Boolean variable for each menu item and set one True and the others False.

Purpose

A multiple variable option menu provides the same functionality as a multiple variable radio button without requiring as much screen real estate. However since only the selected item is visible unless the menu is active, the choices are not immediately obvious. See multiple variable radio buttons (RM) for a visible way of doing the same thing. See radio buttons (RB) or option menus (OP) for non-boolean values.

Format

+name =OM xoff yoff xref yref index +namet +namev +namel default num

+name, xoff, yoff, xref, and yref are as described above in SECONDARY LEVELS.

index
a variable name declared in the variable declarations section. The index of the selected menu item (zero based, i.e., [0..num-1]) is stored in this variable’s current value. The current value determines which item is selected initially.

+namet
indicates that the title to be displayed to the left of the menu is defined by a tertiary line named +namet.

+namev
indicates the variable associated with each menu item is defined by tertiary level variable lines named +namev0, etc. +namev0 corresponds to the top menu item, +namev1 corresponds to the second menu item, etc. There must be a variable line for each of the num menu items. Thus, if num equals 3, then tertiary levels +namev0, +namev1, and +namev2 must be defined. When a menu item is selected, its associated variable is set to True, and the previously selected item’s associated variable is set to False.

+namel
(ell) indicates the label for each menu item is defined by tertiary level label lines named +namel0, etc. The naming is the same as for variable lines, and there must be a label line for each menu item.

default
an integer [0..num-1]. This value selects the item chosen when the Defaults button is pushed.

num
a positive integer indicating how many items are in the list. This many variable and label tertiary lines must be defined.

Example

alongx = { r, True } # x axis is selected
alongy = { r, False } # y axis is selected
index = { r, 0 } # menu index of chosen axis
   :

   :

+f5 = OM 1 1 -1 4 index +f5t +f5v +f5l 0 2
+f5t = Axis of cut
+f5l0 = X=1,n
+f5l1 = Y=1,n
+f5v0 = alongx
+f5v1 = alongy

These lines would generate a pop up menu located 1 character to the right of the left edge of the window and 1 line below the bottom of the level 4 widget. The title to the left of the menu would be Axis of cut. The initial value displayed in the menu window would be X=1,n. Upon clicking on the menu, a two item pop up menu would appear with X=1,n on top and highlighted, and Y=1,n would be the other menu item. If Y=1,n is selected, the current value of alongx will become False, the current value of alongy will become True, and the current value of index will become 1. If Defaults is selected, the current value of alongx will become True, the current value of alongy will become False, and the current value of index will become 0.

the Widget Scrolled List (sl)

What

A scrolled list provides a menu based version of check boxes. One or more items in the list can be selected. Each item is either on or off. Clicking on an item selects it and clears any other selections. Holding down the Control or Ctrl key and clicking on an item adds it to the selected items. All the selected items in the list are highlighted. The number of items in the list that are visible at any one time is specified.

Purpose

Scrolled lists provide the equivalent of check boxes but in less screen real estate. A group of related binary valued variables are accessible through the scrolled list. The settings are never all visible at the same time. See check boxes (CB) for a visible equivalent. See also radio buttons (RB), multiple variable radio buttons (RM), option menus (OP), and multiple variable option menus (OM) for mutually exclusive values.

Format

+name =SL xoff yoff xref yref +namet +namev +namel num visible

+name, xoff, yoff, xref, and yref are as described above in SECONDARY LEVELS.

+namet
indicates that the title to be displayed to the left of the list is defined by a tertiary line named +namet.

+namev
indicates that the variable associated with each list item appearing in the window is defined by tertiary level variable lines named +namev0, +namev1, ..., +namevnum. +namev0 corresponds to the top list item, +namev1 corresponds to the second list item, etc. There must be a variable line and a variable for each of the num list items. Thus, if num equals 3, then tertiary levels +namev0, +namev1, and +namev2 must be defined. When the Defaults button is punched, the default value for each of these variables is copied to the current value.

+namel
(ell) indicates the menu text for each item is defined by tertiary level label lines named +namel0, etc. The naming is the same as for variable lines, and there must be a label line for each list item.

num
a positive integer indicating how many list items there are.

visible
a positive integer indicating how many list items should be visible in the list. If visible is less than num, only visible adjacent list items are displayed at a time and other are accessible via a scroll bar. If visible equals num the list degenerates to a non pop up menu.

Example

ready = { r, False, True } # variable declarations
willing = { r, False, True }
able = { r, False, True }
   :

   :

+f10 = SL 3 1.5 -1 9 +f10t +f10v +f10l 3 2
+f10t = Status
+f10v0 = ready
+f10l0 = Prepared
+f10v1 = willing
+f10l1 = Interested
+f10v2 = able
+f10l2 = Capable

These lines would generate a scrolled list with 2 of 3 items visible. The list would be located 3 characters to the right of the left edge of the window and 1.5 characters (lines) down from the bottom of the widget created in level 9. To the left of the list would be the title Status. The list would show either Prepared and Interested or Interested and Capable, depending on the scroll bar. Initially all list items would be deselected, none would be highlighted, and Prepared and Interested would be visible. If the item labeled Capable were clicked, it would become highlighted, and the variable able would be set to True. If the Defaults button were hit, all would be selected and highlighted, and the variables ready, willing, and able would all be set to True.

the Widget Scale (sc)

What

The scale widget provides an slider for setting an integer value to any one value within a range.

Purpose

This widget is used when a variable can take on any value in an integral range, and it is desired to show the position in the range visually.

Format

+name =SC xoff yoff xref yref varname +namel min max size direction

+name, xoff, yoff, xref, and yref are as described above in SECONDARY LEVELS.

varname
a variable name that must be declared in the variable declarations section of the par file. See VARIABLES for further information on the declaration. This is the variable associated with the scale value. The initial slider position is the current value of this variable. When Accept or Save values is clicked, the current slider position is saved as the new current value of this variable.

+namel
(ell) this names the tertiary level line containing the static text (label) to be displayed to the left of the scale.

min
an integer indicating the minimum value for the slider.

max
an integer indicating the maximum value for the slider.

size
the number of characters high or wide to draw the slider.

direction
either v or V for a vertical line or h or H for a horizontal line.

Example

hour = { r, 1, 12 } # the time of interest
:

:

+f13 = SC 0 3 -1 -1 hour +f13l 0 23 10 h
+f13l = Time Now

These lines would generate a horizontal scale located at the left edge of the window and 3 characters (lines) below the top of the window. The scale would be 20 characters wide. There would be Time Now as a label to the left of the slider. The slider would start at 1 and would be set to 12 whenever the Defaults push button is chosen.

the Widget Text Edit (te)

What

A text edit box is a rectangular area enclosed by a solid outline. When an xform window containing a text edit box is first opened, the text edit box contains the current value of the associated variable. The user can insert information or change the information within a text edit box; that is, the user may edit it. The value within the text edit box is saved when the user activates any of the Accept, Apply, or Save values push buttons or a foreground push button invoke. The value in the text edit box reverts to its default when the Defaults push button is chosen. Nothing happens to it when the Cancel push button is selected.

Purpose

A text edit box allows the user to specify information to the computer by the method of typing information into the box. When the number of choices for an option exceeds four or five or when the choices are not predetermined, a logical widget to use is the text edit box, but see also the labeled text edit widget.

For esthetic purposes, readonly text edit boxes are also available. Use them when there are a number of fields in a column but only some of them are changeable. See the readonly parameter below.

Format

+name =TE xoff yoff xref yref varname size readonly

+name, xoff, yoff, xref, and yref are as described above in SECONDARY LEVELS.

varname
a variable name that must be declared in the variable declarations section of the par file. See VARIABLES for further information on the declaration. This is the variable associated with the value in the text edit box. The initial content of the box is the current value of this variable. When Accept or Save values is clicked, the content of the box is saved as the new current value of this variable. If this variable has a range specified, each character entered is checked for valid format, and the value is checked against the range when the mouse moves or the TAB key is hit.

size
a positive integer indicating the maximum number of characters the text edit box can accommodate. This determines the overall size of the text edit box’s outline.

readonly
This value is optional. For a normal edit field do not use it. For an unchangeable field, put @ro@ in for this value.

Example

file1 = { r, updated.fits, current.fits } # file name
:

:
+f7 = TE 5 3 1 0 file1 20

These lines would generate a text edit box located 5 characters to the right of the rightmost edge of the level 1 widget and 3 characters (lines) below the bottom edge of the level 0 widget. The text edit box could accommodate a maximum of 20 characters. The initial contents of the box would be updated.fits. The variable file1 has been defined to have a default value of current.fits which would appear in the text edit box whenever the Defaults push button was chosen.

the Widget Labeled Text Edit (lt)

What

The labeled text edit widget adds a label to a text edit widget, eliminating the need for a separate static text widget describing the box.

Purpose

The same as the text edit widget only simpler.

Format

+name =TL xoff yoff xref yref varname +namel size placement readonly

+name, xoff, yoff, xref, and yref are as described above in SECONDARY LEVELS.

varname
a variable name that must be declared in the variable declarations section of the par file. See VARIABLES for further information on the declaration. This is the variable associated with the value in the text edit box. The initial content of the box is the current value of this variable. When Accept or Save values is clicked, the content of the box is saved as the new current value of this variable. If this variable has a range specified, each character entered is checked for valid format, and the value is checked against the range when the mouse moves or the TAB key is hit.

+namel
(ell) this names the tertiary level line containing the static text (label) to be displayed with the text edit box.

size
a positive integer indicating the maximum number of characters the text edit box can accommodate. This determines the overall size of the text edit box’s outline.

placement
a letter indicating the position of the label relative to the box. The possible letters are:
a or A label above the box
b or B label below the box
l or L label to the left of the box
r or R label to the right of the box

readonly
This value is optional. For a normal edit field do not use it. For an unchangeable field, put @ro@ in for this value.

Example

time = { r, , , , @[0.0, 24.0)@ } # current time
:

:

+f7 = LT 5 3 1 0 time +f7l 20 l
+f7l = Time Now

These lines would generate a text edit box located 5 characters to the right of the rightmost edge of the level 1 widget and 3 characters (lines) below the bottom edge of the level 0 widget. The text edit box could accommodate a maximum of 20 characters. There would be Time Now as a label to the left of the box. The variable time has no current value so the box will initially be blank, and there is no default value so the box will be blanked whenever the Defaults push button is chosen. In addition only numerical values that follow the format for times will be accepted (e.g., no letters), and the resulting value must range from 0 up to but not including 24.

the Widget Separator (sp)

What

This widget lets the xform window designer divide the window into logical parts. It draws a vertical or horizontal line in the window.

Purpose

This allows sections of the window to be logically distinct.

Format

+name =SP xoff yoff xref yref direction size

+name, xoff, yoff, xref, and yref are as described above in SECONDARY LEVELS.

direction
either v or V for a vertical line or h or H for a horizontal line.

size
the number of characters high or wide to draw the line.

Example

+f7 = SP 0 1 -1 2 h 30

This line would display a line 30 characters wide from the left margin one character below widget number 2.

the Widget Static Raster (sr)

What

This widget lets the xform window designer insert a static graphic in the window.

Purpose

The static graphic may help the user identify a series of windows as being in the same application or related area.

Format

+name =SR xoff yoff xref yref graphicfilename

+name, xoff, yoff, xref, and yref are as described above in SECONDARY LEVELS.

graphicfilename
name of an existing file containing the graphic desired. The file is created using the X tool bitmap(1) .

Example

+f7 = SR 3 3.5 1 0 align.bm

This line would display the graphic stored in align.bm in the location 3 characters to the right of the leftmost edge of the level 1 widget and 3.5 characters (lines) below the bottom of the level 0 widget. Some of the .bm files are align.bm, reticon.bm, coude.bm, eye.bm, and focus.bm.

the Widget Background Pixmap (bp)

What

This widget lets the xform window designer specify the background for the window. However it does not work.

Purpose

The background may help the user identify a series of windows as being in the same application or related area.

Format

+name =BP xoff yoff xref yref graphicfilename

+name, xoff, yoff, xref, and yref are as described above in SECONDARY LEVELS, but the offset and reference values are ignored.

graphicfilename
name of an existing file containing the graphic desired. The file is created using the X tool bitmap(1) .

Example

+f7 = BP 3 3.5 1 0 cfht.bm

This line would display the graphic stored in cfht.bm as the window background.

See Also

cfp(4) , ui_getform.c, cfp_*(3), ui_*(3).

Warnings

As noted above, the start value in RB (radio buttons), the start value in RM (multiple variable radio buttons), and the largest value in PI (push button invoke) do not function as designed.

The push buttons (PB) are currently limited to the actions as specified above.

The background pixmap (BP) does not work.


Table of Contents