home *** CD-ROM | disk | FTP | other *** search
/ PC Online 1997 August / PCO0897.ISO / filesbbs / dos / pmail340.arj / RESOURCE.ZIP / FORMS.TXT < prev    next >
Encoding:
Text File  |  1996-01-21  |  27.4 KB  |  604 lines

  1. ┌────────────────────────────────────────────────────────────────────┐
  2. │                   PMail v3.0 Programmable Forms                    │
  3. └────────────────────────────────────────────────────────────────────┘
  4.  
  5. Contents:
  6.       Introduction
  7.    1: Resource file data structures
  8.    2: The co-ordinate scheme
  9.    3: Data types and operators
  10.    4: The built-in data structures
  11.       - String
  12.       - Text
  13.       - Data
  14.       - Menu
  15.       - Block
  16.       - Dstring
  17.       - Window
  18.       - Integer
  19.       - Struct
  20.    5: The Forms Manager data types
  21.       - Formtable
  22.       - Popup_Menu
  23.       - Line
  24.       - Box
  25.       - Editor
  26.       - Logfile
  27.    6: Formatting the message for transmission
  28.       - Formatting the message headers
  29.  
  30.  
  31. Introduction
  32. ------------
  33.  
  34. To PMail v3.0, a form is simply a resource file containing certain
  35. required statements and an arbitrary number of control statements.  The
  36. format is quite complex, but I make no apology for this - the resulting
  37. forms architecture is extremely powerful and rewards the effort taken to
  38. create the form. It is possible to use the forms manager in PMail to
  39. recreate PMail's own standard editing window, as well as almost any
  40. single-screen data entry form imaginable. The forms manager provides
  41. access to all the most important PMail features, including address books,
  42. user lists, distribution lists and more.
  43.  
  44. Forms are prepared using a text editor such as Brief, DTE or (shudder)
  45. DOS EDIT, and are then compiled using the PMail resource compiler,
  46. ResCom. Forms are made available to users via the PM-MENU.RSC external
  47. interface mechanism in PMail v3.0 - examine the sample PM-MENU.R source
  48. file supplied with the PMail archive for more information on this 
  49. structure.  Resources in the file number from 0 and can take the form of
  50. several different data structures: a thorough understanding of the data
  51. types the forms manager uses is the essential key to being able to use
  52. the forms manager effectively.
  53.  
  54.  
  55. 1: Resource file data structures
  56. --------------------------------
  57. The data structures used in forms fall into two general categories -
  58. built-in, and user-defined. The built-in data types are special hooks
  59. into internal mechanisms used by PMail's underlying user interface code
  60. and take a very strict, occasionally abstruse form. Some of the fields in
  61. the built-in data types will seem obscure, irrelevant or will simply
  62. never be used in the context of the forms manager, a hang-over from their
  63. use outside the realm for which they were originally intended. The
  64. built-in data types recognized by ResCom are:
  65.  
  66.   String, Text, Data, Menu, Block, Dstring, Window, Integer, Struct
  67.  
  68. The other class of data type is the user-defined group. The ResCom
  69. resource compiler supports a special type definition mechanism called a
  70. typedef which allows arbitrary data structures to be declared and used in
  71. resource files. Several user-defined data structures have been developed
  72. for use with the Forms manager - these are declared in the file FORMS.RH,
  73. which accordingly must be included in every form file's source code using
  74. the INCLUDE instruction before the first time any of the data structures
  75. are used. The major user-defined structures used in Forms management are:
  76.  
  77.    Formtable, popup_menu, line, box, editor, log
  78.  
  79.  
  80. 2: The co-ordinate scheme
  81. -------------------------
  82. Many of the data structures used in forms design refer to a position on
  83. the screen: PMail's co-ordinate scheme runs from the top left of the
  84. window (at 1,1) to the bottom right.
  85.  
  86.  
  87. 3: Data types and operators
  88. ---------------------------
  89. Pegasus Mail is written in the C programming language, and the Resource
  90. compiler makes a number of assumptions based on this fact.  It also uses
  91. a certain number of terms and operators derived loosely from the C
  92. language (such as the struct data type, the typedef keyword and the
  93. bitwise operators). The resource compiler makes the following assumptions
  94. in particular:
  95.  
  96. * Integers are 16-bit signed entities in the range -32768 to 32767.
  97. * Strings are arbitrary arrays of ASCII characters terminated with a
  98.   single ASCII NUL (0) character.
  99.  
  100. The Resource compiler supports extremely simple integer arithmetic
  101. expressions evaluated strictly from left to right with no parenthesis
  102. operator. It is important to remember this if you use expressions, since
  103. what you are used to from C and Pascal will NOT hold true in a resource
  104. definition - to the resource compiler, 3 + 4 * 6 = 42. The following
  105. arithmetic operators are supported:
  106.  
  107.    + - * /  - Plus, Minus (binary and unary), Multiply, Divide
  108.    |        - Bitwise OR operator (7 | 7 = 7);
  109.    &        - Bitwise AND operator (128 & 127 = 0)
  110.    ^        - Bitwise XOR operator (8 ^ 15 = 7)
  111.  
  112. The very first resource in the file (resource 0) must be a STRING
  113. resource containing the title of the form.
  114.  
  115.  
  116. 4: The built-in data structures
  117. -------------------------------
  118.  
  119. String
  120. ------
  121. The String data type declares an arbitrary string of ASCII characters of
  122. any length. Strings are usually used for single-line text resources such
  123. as window titles and default records. Strings can contain any ASCII value
  124. except the value zero which is used as a terminator (ResCom supplies the
  125. terminator automatically). Strings must be enclosed within quotes (") in
  126. the resource source file.
  127.  
  128. Text
  129. ----
  130. A text resource is essentially a scaled-up version of a string, intended
  131. to be multi-line. Text resources are used for large amounts of textual
  132. data such as help screens and formatting records for messages. Text
  133. resources can contain any ASCII character except zero, and ResCom will
  134. recognize certain "escapes" within strings:
  135.  
  136.    \r   -  replaced with a single carriage return character (13)
  137.    \n   -  replaced with a single newline character (10). A newline
  138.            is all that is required to indicate end of line for those
  139.            routines in the forms manager which display blocks of text
  140.            on the display
  141.    \e   -  Replaced with the Escape character (27)
  142.    \t   -  Replaced with the Tab character (9)
  143.    \"   -  Replaced with a single quote character
  144.    \\   -  Replaced with a single virgule ('\') character
  145.  
  146. Data
  147. ----
  148. A data resource defines a single data entry point on the screen into
  149. which the user can type information. The data record has the following
  150. structure:
  151.  
  152.    1: (Integer)  X (Horizontal) position of field on screen
  153.    2: (Integer)  Y (Vertical) position of field on screen
  154.    3: (Integer)  Maximum width ON SCREEN of the field
  155.    4: (Integer)  Maximum length of the variable (may be
  156.                  longer than the on-screen width)
  157.    5: (Integer)  Colour for an active field
  158.    6: (Integer)  Colour for a non-active field
  159.    7: (Integer)  Help, or arbitrary ID field for the entry
  160.    8: (Integer)  The data type of the field. Use the GT_*
  161.                  constants in defines.rh - eg, GT_INTEGER
  162.    9: (Integer)  Control flags for the entry: OR together the
  163.                  G* constants in defines.rh - eg GEND, GSECRET
  164.  
  165. Values 5, 6 and 9 are sensibly defaulted if 0. All other fields should
  166. have non-zero values, and have no defaults. The help value is always
  167. ignored by the forms manager and should be zero, since it is replaced by
  168. the help value defined in the formtabl record for the form.
  169.  
  170. Menu
  171. ----
  172. The menu data structure defines a menu with scrolling lightbar and
  173. keystroke selection. In terms of the forms manager a menu record is
  174. always used in association with the popup_menu user-defined data type
  175. and a menu cannot appear on its own. The menu type consists of a header
  176. followed by an array of menu records. The header has up to five integer
  177. values:
  178.  
  179.    1:  The total number of entries in the menu (must be < 24)
  180.    2:  The menu mode (any of the M* constants in defines.rh ORed)
  181.    3:  The offset of the default choice in the menu (starting from 0)
  182.    4:  The colour of a normal entry
  183.    5:  The colour of a selected entry
  184.  
  185. All the header values except 1 are sensibly defaulted
  186.  
  187. A menu record describes on entry in the menu: it is built as follows:
  188.  
  189.    1:  (Integer)  The X (horizontal) position of the item
  190.    2:  (Integer)  The Y (vertical) position of the item
  191.    3:  (Integer)  An optional help or ID value for the item       
  192.    4:  (Char)     The keystroke which selects this item
  193.    5:  (Integer)  The value to return if this item is selected
  194.    6:  (String)   The text to display for the choice
  195.       
  196. No item in a menu record is defaulted. Within the structure of the forms
  197. manager the Y and help values are always ignored.
  198.  
  199. Block
  200. -----
  201. A block is a set of strings displayed at the same X position on the
  202. screen, with the Y position incrementing with each string.  Block
  203. definitions are as follows:
  204.  
  205.    1: (Integer)  X (horizontal) position for block
  206.    2: (Integer)  Initial Y (vertical) position for block
  207.    3: (Integer)  Colour/mode word. OR together colours from
  208.                  defines.rh, and optionally OR position modifiers
  209.                  (such as wcentre, wadjacent).
  210.    4...n:        The strings to display.
  211.  
  212. To define a colour for a block you will usually combine a foreground
  213. colour and a background colour using the Resource compiler's OR operator
  214. ('|') - so for example, to create a block of text which is presented as
  215. white on blue you would use "WHITE | BBLUE". If you give only a
  216. foreground colour, the default background colour of the window will be
  217. used for the text.  Text can be centred within the window by combining
  218. the "wcentre" attribute with the colour integer using the OR operator.
  219. So, to display a block of text in Yellow on Light Grey centred in the
  220. current window, you would use the expression 
  221.    "YELLOW | BLIGHTGREY | wcentre".
  222.  
  223. American users: please notice the English spelling of "Grey" and "Centre"
  224. - you may wish to change these in DEFINES.RH if you are more comfortable
  225. with the US spelling.
  226.  
  227. Colour changes within strings: you can change between bright and normal
  228. video in mid-string by embedding Ctrl-A (ASCII 001) characters in the
  229. string. Each time a Ctrl-A is encountered the brightness mode is toggled.
  230. Embedding Ctrl-B characters toggles between normal and reverse video.
  231.  
  232. Dstring
  233. -------
  234. A dstring is a single-string version of a block. The X, Y and Attribute
  235. integers are identical but only one string may be provided.  Dstrings
  236. load and display faster than blocks.
  237.  
  238. Window
  239. ------
  240. The Window is the basic screen unit in PMail. Windows have local
  241. co-ordinate schemes starting at 1,1 for the top-left corner and preserve
  242. the screen beneath them, restoring it when they close. All forms in PMail
  243. must appear in a window: a form with no F_WINDOW resource is regarded by
  244. the forms manager as a template record for a standard editing screen. The
  245. Window data structure looks like this:
  246.  
  247.    1: (Integer)  X (Horizontal) position of window on screen
  248.    2: (Integer)  Y (Vertical) position of window on screen
  249.    3: (Integer)  Width of the window
  250.    4: (Integer)  Depth of the window
  251.    5: (Integer)  Colour and characteristics of window frame
  252.       - OR with colour and w* constants in defines.rh,
  253.       for example "wzip | BBLUE | WHITE".
  254.    6: (Integer)  Default text colour/attribute in window
  255.    7: (Integer)  Default fill character for window
  256.    8: (Integer)  Linestyle for window frame - use the B*
  257.       constants in defines.rh - eg, BSINGLE, BDOUBLE
  258.    9: (String)   Title for the window (maximum 40 characters)
  259.  
  260. Values 5, 6, 7 and 8 are sensibly defaulted if 0.
  261.  
  262. Integer
  263. -------
  264. Almost never used in forms, this data type declares a single integer
  265. value expressed in decimal form.
  266.  
  267. Struct
  268. ------
  269. Almost never used in forms, this data type allows you to agglomerate
  270. completely arbitrary data with no predefined format. Its use is not
  271. described in this document.
  272.  
  273.  
  274. 5: The Forms Manager data types
  275. -------------------------------
  276.  
  277. The forms manager uses the following data types defined in FORMS.RH to
  278. create the data structures necessary to present a form.
  279.  
  280. Formtable
  281. ---------
  282. The most important single data type in a form, the formtable defines
  283. the order of data entry in the form and gives the forms manager the
  284. means to associate individual resources in the form with the various
  285. components of the message the form generates. The formtable resource
  286. must ALWAYS be the very last resource in the resource file, and is an
  287. array of an arbitrary number of structures consisting of six integers
  288. arranged as follows:
  289.  
  290.    1:  Resource number of the entry associated with this item. Since
  291.        the resource compiler expects resources to be named, you can
  292.        use the name you gave the resource in this field. It is
  293.        possible to use a resource ID of 0, usually when you want to
  294.        initialize a field in the message without any associated user
  295.        intervention.
  296.    2:  Correlation (see below)
  297.    3:  Resource number of the help for this entry; must be text type.
  298.    4:  Validation: for future use - not used in this release.
  299.    5:  Text resource containing the item's status line text (0 for none)
  300.    6:  Default: for booleans, 1/0; for ints/strings; resource ID
  301.  
  302. The correlation value is used to tell the forms manager what the item
  303. represents in e-mail terms, and must be selected from the following list:
  304.  
  305.    F_TO              Message's To: field
  306.    F_SUBJECT         Message's Subject: field
  307.    F_CC              Message's CC: field
  308.    F_BCC             Message's BCC: field
  309.    F_REPLY_TO        Message's Reply-to: field
  310.    F_READING         Message's Reading confirmation flag
  311.    F_DELIVER         Message's delivery confirmation flag
  312.    F_NOSIG           Message's "omit signature" flag
  313.    F_ENCRYPT         Message's encrypt flag
  314.    F_KEY             Message's encryption key
  315.    F_COPYSELF        Message's copy-self flag
  316.    F_MESSAGE         Message's text (usually an editor data type)
  317.    F_ATTACH          Message's attachment list
  318.    F_URGENT          Message's "urgent" flag
  319.    F_STRING          User-defined string field (max length 200 chars)
  320.    F_INTEGER         User-defined integer field
  321.    F_BOOLEAN         User-defined boolean (Y/N) field
  322.    F_SMTP_TEMPLATE   Formatting template to produce the output message
  323.    F_WINDOW          The window for the form
  324.    F_LOG             A logging resource
  325.    F_SERIAL          Serial number resource
  326.    F_STATUS          A status area (always a Box data type)
  327.  
  328. A correlation value of 0 is only legal for inert screen drawing elements
  329. such as lines, boxes and dstrings; defining a correlation of zero for any
  330. other form element will almost certainly result in PMail crashing when
  331. you attempt to run the form.
  332.  
  333. The help field in the formtable represents the resource ID of the
  334. resource which should be invoked in response to a request for
  335. context-sensitive help while this field is active.
  336.  
  337. The validation field will in future versions of PMail allow you to define
  338. a set of validation rules which should be applied to the data the user
  339. enters. In this release it is unimplemented and should be set to zero.
  340.  
  341. The status field refers to the resource ID of a block data type which
  342. should be displayed in the status area of the form when this field is
  343. active. Any user-interaction item can have status text, which is
  344. enabled by created a resource of type Box in the file and correlating
  345. it in the formtable to the F_STATUS correlation value. The Box type
  346. defines the bounding area of the status text area. For an example of
  347. defining and using status text, see the sample telephone message form
  348. provided with PMail 3.0, tphone.r.
  349.  
  350. The default field is the ID of a resource which should be loaded as a
  351. default value for the field. For fields where the data type is a Boolean
  352. value (yes or no) the default field is either 0 or 1 depending on the yes
  353. or no value of the field. For Integer and String data types the field
  354. refers to a resource which must be of string type. While it may seem odd
  355. to have a string as a default for an Integer field, this allows
  356. environment values such as the date or time to be used as defaults for
  357. Integer fields using form substitution (see below).
  358.  
  359. The order in which entries appear in the formtable defines the "tab
  360. order" of the form, or the order in which the Forms Manager will process
  361. the form's fields. The Forms Manager paints inert screen drawing elements
  362. such as lines and boxes in the order they appear in the formtable, which
  363. allows you to overlay text and graphic elements by ordering them
  364. carefully. Data entry elements such as data fields and popup menus are
  365. also processed in the order in which they appear in the formtable.
  366.  
  367. Popup_Menu
  368. ----------
  369. The Popup_Menu data type is used to create a popup menu in the form.
  370. When the user enters a popup menu field, an arrow will blink next to
  371. the field indicating that a menu is available by pressing <Enter>.
  372. If the user presses <Enter>, the menu will popup and the user will be
  373. able to choose from it. The "return value" of the menu, or the value
  374. which can be substituted into the message, is the text selected from
  375. the menu itself. The Popup_Menu data structure is defined as seven
  376. integers arranged as follows:
  377.  
  378.    1:  Resource ID of menu (use the name you gave the menu)
  379.    2:  X-coord. on the screen of the top left of the popup window
  380.    3:  Y-coord. on the screen of the top left of the popup window
  381.    4:  X-coord. on the screen where the menu result should display
  382.    5:  Y-coord. on the screen where the menu result should display
  383.    6:  Attribute word for the popup menu (colours etc)
  384.    7:  Attribute word for the menu result display text
  385.  
  386. Line
  387. ----
  388. A line resource simply allows you to draw a line on the screen. It
  389. consists of five integers and a character arranged as follows:
  390.  
  391.    1:  X position of start of line
  392.    2:  Y position of start of line
  393.    3:  If non-zero, the width of the line (horizontal)
  394.    4:  If non-zero, the height of the line (vertical)
  395.    5:  The colour attributes of the line
  396.    6:  The character to use to draw the line.
  397.  
  398. The line can be drawn with IBM extended ASCII characters; the ASCII
  399. values 196 and 205 draw single and double horizontal lines
  400. respectively, while the ASCII values 179 and 186 draw single and
  401. double vertical lines respectively. You can, of course, use any
  402. character you wish to draw a line except an ASCII NUL (0).
  403.  
  404. Box
  405. ---
  406. The Box resource draws an unfilled box on the screen using one of
  407. several line styles. The resource consists of six integer values
  408. organized as follows:
  409.  
  410.    1:  X position of top left corner of box
  411.    2:  Y position of top left corner of box
  412.    3:  Width (across the screen) of the box in characters
  413.    4:  Height (down the screen) of the box in characters
  414.    5:  Line style - select one of the following values
  415.        BSINGLE - single lines all around
  416.        BDOUBLE - double lines all around
  417.        BMIXED  - single vertical and double horizontal lines
  418.        BSOLID  - thick lines all around
  419.        BDOTS   - dotted lines all around
  420.    6:  Attribute word - colours etc.
  421.  
  422.  
  423. Editor
  424. ------
  425. The editor data type allows you to create a rectangular text editor
  426. in the form, usually for editing the text of the message. The editor
  427. type is defined as eight integers laid out as follows:
  428.  
  429.    1:  X co-ordinate of top left corner of editor rectangle
  430.    2:  Y co-ordinate of top left corner of editor rectangle
  431.    3:  Width of editor rectangle on screen
  432.    4:  Depth of editor rectangle on screen
  433.    5:  Maximum line length in editor (may be wider than width (3)
  434.    6:  Maximum number of lines of text the editor can accept
  435.    7:  Maximum number of characters the editor will accept
  436.    8:  Colour attributes for editor area.
  437.  
  438. Note that the line length may be wider than the width of the editor
  439. on screen - if it is, the editor will scroll horizontally when it
  440. reaches the right hand edge of the screen rectangle. The maximum size
  441. of the text an editor record can accept is 32000 bytes. An editor is
  442. almost always associated with the F_MESSAGE correlation in the form
  443. table since this is the only correlation which allows more than 200
  444. characters of data.
  445.  
  446. Logfile
  447. -------
  448. A log record is a special optional resource which can appear in the
  449. form to allow the message to be logged. After the message has been
  450. successfully sent, the last thing the Forms Manager does before
  451. tidying up and returning control to PMail is to scan the formtable
  452. for entries with the correlation set to F_LOG. For each F_LOG entry
  453. it finds it expects to find a logfile resource laid out as follows:
  454.  
  455.    1: (string, max 64 characters) the name of the log file
  456.    2: (integer) Resource ID of the text logging resource.
  457.  
  458. The filename is the name of the file to which the log information
  459. should be appended. If it does not exist, the Forms Manager will
  460. create it. In order for this facility to be useful, the logfile must
  461. clearly be in a location where the user has write access.
  462.  
  463. The resource ID must refer to a Text resource in the resource file
  464. which should be used to format the logging record added to the log
  465. file. The same substitution mechanisms used to format the outgoing
  466. message (see below) can be used to substitute values from the form
  467. into the logging record.
  468.  
  469.  
  470. 6: Formatting the message for transmission
  471. ------------------------------------------
  472.  
  473. Getting the data from the user is only half the work of the Forms
  474. Manager - the other half is creating the outgoing message based on
  475. that data.
  476.  
  477. When the user has accepted the data in the form by pressing
  478. Ctrl-Enter or by "dropping through the bottom" of the form, the Forms
  479. Manager scans the formtable for an entry where the correlation is set
  480. to F_SMTP_TEMPLATE (the name is an anachronism - the same template is
  481. used for all message transports). If it does not find one, the entry
  482. in the table with the F_MESSAGE correlation is sent unaltered as the
  483. body of the message. If an F_SMTP_TEMPLATE correlation is found,
  484. however, the Forms Manager expects it to be a text resource which
  485. contains the format of the outgoing message body.
  486.  
  487. The formatting template consists of lines of text ending in the \n
  488. text escape; embedded in the text lines there will usually be special
  489. substitution strings which are replaced by fields from the form or
  490. which perform special formatting functions. Anything in the text
  491. resource which is not a substitution string is printed literally to
  492. the message. Substitution strings are always enclosed in curly
  493. brackets ('{' and '}') in the formatting record - so in the line
  494.  
  495.    "This is a sample string printed on {rfc-date}\n"
  496.  
  497. there is a stream of regular text which will be printed to the
  498. message unaltered, and a single substitution called "rfc-date" which
  499. will be replaced by the current date and time in RFC-822 format.
  500. Substitution strings are considered to be zero characters wide for
  501. formatting purposes, so a formatting string which results in an empty
  502. string will introduce no text into the message at all.
  503.  
  504. The following substitution strings can be used in templates, both for
  505. logging and for messages:
  506.  
  507. {to}           The message's TO: address field
  508. {subject}      The message's SUBJECT: field
  509. {cc}           The message's CC: field
  510. {bcc}          The message's BCC: field
  511. {reply-to}     The message's REPLY-TO: field
  512. {reading}      The message's reading confirmation flag (Y or N)
  513. {delivery}     The message's delivery confirmation flag (Y or N)
  514. {no-signature} The message's no-signature flag (Y or N)
  515. {encrypt}      The message's encryption flag (Y or N)
  516. {key}          The encryption key for the message
  517. {copyself}     The message's copy-to-self flag (Y or N)
  518. {message}      The message's text (the F_MESSAGE correlation)
  519. {urgent}       The message's urgent flag (Y or N)
  520. {field x}      The value of item number X in the formtable
  521. {rfc-date}     The time and date in full RFC-822 format
  522. {day}          The name of the current day
  523. {nday}         The number in the month of the current day
  524. {month}        The name of the current month
  525. {nmonth}       The number of the current month
  526. {year_2}       The current year expressed in two digits
  527. {year_4}       The current year expressing as a full four digits
  528. {username}     The name of the current user
  529. {servername}   The name of the server into which the user is logged.
  530. {tab x}        Pad with spaces to column X across the message
  531. {hour}         The hour component of the current time
  532. {minute}       The minute component of the current time
  533. {serial file}  Serial number resource - see below
  534. {domain}       The server's Internet name, defined in PCONFIG
  535. {ifdef field}  Terminates evaluation if the specified field is empty
  536. {lcb}          A literal left-curly-bracket character ( { ).
  537. {rcb}          A literal right-curly-bracket character ( } ).
  538. {ascii x}      Inserts the ASCII character with value 'x' in the message.
  539.  
  540. The {message} substitution is column-sensitive: if it appears at a
  541. position indented from the left-hand edge of the template, the entire
  542. message text will print starting at that column. This allows you to
  543. set a kind of "indented left margin" for the message.
  544.  
  545. The {Serial} substitution allows you to define an automatically
  546. incrementing number stored in a writable file on the network. The
  547. file parameter to the substitution consists simply of a fully-
  548. qualified path in DOS or NetWare format to the file containing the
  549. serial number value. The file should contain the serial number as a
  550. simple ASCII string on a single line ending with a CR-LF pair - you
  551. can create this file using any standard text editor. Note that to be
  552. useful the file must be writable by anyone able to use the form; as
  553. well, the serial number is read and incremented the moment the Forms
  554. Manager encounters the {Serial} substitution, so take care if you use
  555. it to initialize a string in the form. There is no provision for
  556. "winding back" a serial number if the user aborts the form or if
  557. delivery fails.
  558.  
  559. Substitution widths: all substitutions can be given a width in the
  560. message by ending them with ":x", where X is the width of the field
  561. in which the substituted text should appear. As an example, if you
  562. want the current value of item 7 in the formtable to be printed in a
  563. field 50 wide, you would use the substitution "{field 7:50}". Items
  564. are always left-justified in fields.
  565.  
  566.  
  567. Formatting the message headers
  568. ------------------------------
  569. You may on occasion want to use data supplied by the user in one of
  570. the standard header fields of your message (for instance, in the
  571. subject field). To do this, create a header formatting entry in the
  572. form table using this format:
  573.  
  574.    <format_string>, F_HEADER, 0, 0, 0, <header_id>
  575.  
  576. "format_string" should refer to a "string" resource containing the
  577. format you want used in the field.
  578.  
  579. "F_HEADER" indicates to the form manager that this header should be
  580. processed after data entry has finished but before the message is
  581. sent.
  582.  
  583. "header_id" in the "default" field tells the form manager which
  584. header in the message should be set via this substitution. Valid
  585. values are F_TO, F_CC, F_BCC, F_REPLY_TO, and F_SUBJECT.
  586.  
  587. Example: say in your form, field 12 contains a person's name, field
  588. 14 contains that person's phone number, and you have defined a string
  589. resource in your file like this:
  590.  
  591.    string subject_str "{ifdef 12}Phone call: {field 12}, {field 14}";
  592.  
  593. Then you could create this entry in your FORMTABLE resource:
  594.  
  595.    subject_str, F_HEADER, 0, 0, 0, F_SUBJECT
  596.  
  597. Which would result in the form manager constructing the message's
  598. "subject" field according to the substitution you defined. So, if
  599. field 12 contained "Mr Bloggs" and field 14 contained "408-555-1212",
  600. then the message's subject would be set to:
  601.  
  602.    Subject: Phone call: Mr Bloggs, 408-555-1212
  603.  
  604.