Data screens are often made up of multiple small subtables, each grouping together related data items. When developing a screen layout, the size of each subtable is often not known early on. As a result, the relative positioning of the tables on the screen cannot be determined until the smaller tables are defined. With Table, you can define each subtable separately, then combine them in a variety of ways, viewing the results in order to determine the optimal organization.
Table supports the organization of data into columns and allows the use of attributes and the PC line-drawing characters to help annotate your tables. The syntax of table is designed to provide the most common formatting options with the simplest syntax possible.
Table source code is stored in a file with the extension ".tbl". Appgen will generate commands to translate this file into a ".fld" file using the table compiler.
For the purposes of getting familiar with table, you can run
the table compiler yourself by hand; if you place your table
source code in a file named test.tbl
, you can
generate test.fld
with the command:
table test.tbl >test.fldYou can then view the results using scrpaint:
scrpaint test.fldYou may wish to use scrdes to create a configuration file test.cfg with suitable color attributes for the generated screen also.
{ "Text on line 1"; Line2: ; "Line 3" }Some things to notice are:
When more than one word appears on a line, table arranges the output into columns:
{ Col1: Col2; A B; C D; }Multiple words can be treated as a single word by enclosing the words in quotation marks (""). A single word by itself on a line of a table is not treated as part of the first column; it essentially spans all the columns. This is useful for adding titles to a table:
{ "Table with Columns"; A B C D E; F G H I J; }
(mnemonic[,width[,height]])
where mnemonic is the name of the datum,
width is the width in characters and height is
the height in rows. Width and height are optional and default to
5 characters wide and 1 row high:
{ "Lamp Module"; A_UVV: (A_UVV,5) V; A_IRV: (A_IRV,5) V; A_LMT: (A_LMT,6) C; }When data fields are arranged in a column, they are right-justified within the column. Labels are left-justified within columns. It is possible to alter this justification scheme by several means for special cases, but this seems to be the "right thing" in most cases.
HBox { anti; dis; establishment; arianism }
The following table will have dividing lines above, below and between the A and B sections:
{ -; A_UVV: (A_UVV,5); A_IRV: (A_IRV,5); -; B_UVV: (B_UVV,5); B_IRV: (B_IRV,5); -; }To form an enclosing box, you must nest a table inside an HBox (or vice versa):
HBox { |; { -; A_UVV: (A_UVV,5); -; }; |; }The line-drawing symbols may have a '+' symbol before and/or after it to indicate that the line should be extended to connect to neighboring lines. A '+' before or after a horizontal line symbol extends the line to the left or right, respectively. A '+' before or after a vertical line symbol extends the line up or down.
In the previous example, the box would not actually be closed. The horizontal lines in the nested table need to be extended to meet the enclosing vertical lines. This is accomplished by replacing the '-' symbols with the string '+-+'.
A named table is a table which is defined before the main table definition which has a name associated with it:
LampA { HBox{ +-; "Lamp A"; -+; }; A_UVV: (A_UVV,5); A_IRV: (A_IRV,5); }The named table can then be referenced within other tables by enclosing the table's name in square brackets ([]):
{ HBox { |; [LampA]; |; [LampB]; | } }
{ >"Lamp A"<; A_UVV: (A_UVV,5); }Note that the horizontal line-drawing characters have the same effect, except that the space is filled with a line. In most cases you will want to use one or the other, not both.
By default, text uses attribute value 4 ("LABEL"), data fields use attribute value 2 ("FIELD") and line-drawing characters use attribute value 1 ("BOX"). The keyword "Title:" switches the current text attribute to 5 ("TITLE"), and the keyword "Header:" switches the attribute to 3 ("HEADER"). You can also switch to an explicit attribute number, n, by specifying "Attr n".
The new attribute value remains in effect until another attribute is specified or until the end of the current table row or the current HBox.
Overlay { (%TMA:Flightalgo:1,0+1,2) (%TMA:Labalgo:1,0+1,2) }This is useful in the case where only one of the data fields will be used at a time. In the example, only one of Flightalgo or Labalgo will be used at a time, so the status information can be located in the same position.
Glue dimensions are specified either as a single integer, if there is no stretch component, or as two integers separated by a '+' symbol, e.g. 3+1, indicating 3 spaces plus 1 stretch.
You may use glue dimensions when specifying the width or height of data fields. You can also insert glue explicitly into a table or HBox by using either the HGlue or VGlue commands. VGlue is used in the example below to center the data vertically within the available space.
{ VGlue 0+1; -; Center: (data,3); -; VGlue 0+1; }
Glue : HGlue / VGlue .Glue can be either HGlue or VGlue (not both). Productions are terminated by a period (.).
Program : NamedTable* Table . NamedTable : BareWord Table . Table : [ 'Table' ] '{' TableDefs '}' . TableDefs : / TDunterminated [ ';' ] . TDunterminated : VField / TDunterminated ';' VField . HBox : 'HBox' '{' HBFields '}' . HBFields : / HBunterminated [ ';' ] . HBunterminated : HField / HBunterminated ';' HField . VField : GAField / Columns . CField : GAField . HField : GAField . Columns : CField CField+ . GAField : [ Attr ] GField . Attr : 'Title:' / 'Header:' / 'Attr' Integer . GField : Table / HBox / TableRef / Align / HWord / Datum / Rule / Overlay / Glue . AField : Table / HBox / TableRef / HWord / Datum / Overlay / Rule . TableRef : '[' BareWord ']' . Align : LeftAlign HAField RightAlign . HAField : AField . LeftAlign : LeftAlignChar+ . RightAlign : RightAlignChar* . LeftAlignChar : '>' . RightAlignChar : '<' . HWord : Word . Datum : '(' Word DatumDimensions ')' . DatumDimensions : / ',' Dimension / ',' Dimension ',' Dimension . Word : BareWord / CString . Glue : HGlue / VGlue . HGlue : 'HGlue' Dimension . VGlue : 'VGlue' Dimension . Dimension : Space [ GlueSpec ] . Space : Integer . GlueSpec : '+' Integer . Rule : RuleString .
Return to Manuals Guide
last updated: Thu Jan 2 10:56:36 2003 | webmaster@huarp.harvard.edu |
Copyright 2004 by the President and Fellows of Harvard College |