constructformdataeditors
TEMPLATE

The constructformdataeditors statement creates a column of form elements for editing data fields (or variables).


Parameters

This statement has one parameter:

template – text and tags that specify options for constructing one or more form data editing elements (see discussion below).


Description

This statement automatically creates form elements for editing data. In its simplest form, it creates a text editor for each visible (non-hidden) field in the database.

constructformdataeditors ""

The template parameter allows you to customize how form elements are generated. You can specify which fields (or variables) are included, the size, alignment, etc. Each item can have tags that customize the generated object, and there are tags for overall options as well. These tags are discussed below.

Keep in mind that this statement generates regular form objects, just as if you had created them manually. Once the objects are generated, you can manipulate these objects in Graphics Mode any way you like.

Fields & Variables

To specify which fields (or variables) should be included in the generated form, simply include a carriage return delimited list of the fields and/or variables. This example will generate 5 text editor objects, for the Name, Address, City, State and Zip fields.

constructformdataeditors 
    "Name"+cr()+
    "Address"+cr()+
    "City"+cr()+
    "State"+cr()+
    "Zip"

Make sure you spell the field names correctly – if you misspell one a variable will be automatically created instead.

Tags

To customize the generated form objects you can include one or more tags. Like HTML tags, these tags start and end with < and > characters. Some tags need to be attached to a specific field or variable, for example to specify generating a pop-up menu, checkbox, radio button etc. instead of a regular text editors, or to specify min and max values for a field or variable. Other tags should be placed at the top of the and control overall specifications – for example the font and text size. If you are creating a dialog, this statement can even generate the buttons for you.

Checkboxes

Use the <checkbox:value> or <check:value> tag to generate a checkbox. The tag should be on the same line as the field or variable name. This example generates the same 5 text editor objects as the previous example, plus a checkbox for the Rush field (or variable).

constructformdataeditors
    "Name"+cr()+
    "Address"+cr()+
    "City"+cr()+
    "State"+cr()+
    "Zip"+cr()+
    "Rush<checkbox:TRUE>"

As you can see, the on value of the checkbox is specified after the colon (the off value is always blank). If you don’t specify the on value it defaults to "TRUE".

You can optionally supply a title for the checkbox that is different from the field name. For example, this code will genate a checkbox that is linked to the Rush field, but will have a title of Rush Order.

Rush<checkbox:TRUE:Rush Order>

Just like in the previous example, the Rush field will be assigned the value TRUE when the checkbox is clicked (and empty when it is unclicked).

Checkbox Groups

If the checkbox tag has multiple values, a group of checkboxes will be created. Unlike a group of radio buttons, this allows multiple values to be checked.

constructformeditors
    "Toppings<checkbox:Cheese,Pepperoni,Sausage,Tomato,Olives,Anchovies>"

If multiple values are checked, the values will be separated by a separator character (or characters). The default separator character is a carriage return, but you can use the <separator:text> tag to specify any separator text you want.

If you want the checkbox titles to be different from the values, you can add a separate title for each item.

Toppings<checkbox:c:Cheese,p:Pepperoni,s:Sausage,t:Tomato,o:Olives,a:Anchovies>

With this code, the form will look the same, but the data values stored in the Toppings field will be single characters, for example c,p instead of Cheese,Pepperoni.

The checkboxes are normally arranged vertically, but if the <across> tag is included on the same line they will be arranged horizontally. Note that if checkboxes are arranged horizontally, the widths will be approximate. You will probably have to manually adjust the arrangement a bit for the best appearance.

Pop Up Menus

Use the <popup:value,value,value> or <menu:value,value,value> tag to generate a popup menu. The tag should be on the same line as the field or variable name. This example adds a pop-up menu for the credit card type.

constructformdataeditors
    "Name"+cr()+
    "Address"+cr()+
    "City"+cr()+
    "State"+cr()+
    "Zip"+cr()+
    "Rush√YES"+cr()+
    "Card<popup:Master Card,Visa,American Express,Discover>"

As shown in the example above, the <card> tag includes a comma separated list of the items to appear in the pop-up menu. If you need to include a comma in a menu item you can specify the items with separate <value> tags, described below.

Radio Buttons

Use the <radio:value,value,value> tag to generate a group of radio buttons. The tag should be on the same line as the field or variable name. This example adds a text list for the credit card type.

constructformdataeditors
    "Name"+cr()+
    "Address"+cr()+
    "City"+cr()+
    "State"+cr()+
    "Zip"+cr()+
    "Rush√YES"+cr()+
    "Card<radio:Master Card,Visa,American Express,Discover>"

If you want the radio button titles to be different from the values, you can add a separate title for each item.

Card<radio:m:Master Card,v:Visa,a:American Express,d:Discover>

With this code, the form will look the same, but the data values stored in the Card field will be single characters, for example m instead of Master Card.

The radio buttons are normally arranged vertically, with one radio button per line. If you want to arrange the radio buttons horizontally, use the <across> tag, like this:

        "Card<radio:Master Card,Visa,American Express,Discover><across>"

Note that if radio buttons are arranged horizontally, the widths will be approximate. You will probably have to manually adjust the arrangement a bit for the best appearance.

As shown in the examples above, the <radio> tag includes a comma separated list of the items to appear in the pop-up menu. If you need to include a comma in a menu item you can specify the items with separate <value> tags, described below.

List

Use the <list:value,value,value> tag to generate a list. The tag should be on the same line as the field or variable name. This example adds a text list for the credit card type.

constructformdataeditors
    "Name"+cr()+
    "Address"+cr()+
    "City"+cr()+
    "State"+cr()+
    "Zip"+cr()+
    "Rush√YES"+cr()+
    "Card<list:Master Card,Visa,American Express,Discover>"

As shown in the example above, the tag includes a comma separated list of the items to appear in the pop-up menu. If you need to include a comma in a menu item you can specify the items with separate <value> tags, described below.

Lists default to six lines high. If there are more than six items in the list, you can scroll the list. You can also change the generated height of the list with the <lines> tag, described below.

Values with Commas

If you need to include values with commas with the <popup>, <radio>, or <list> tags you can specify the values in separate tags, like this:

constructformdataeditors
    "Office"+cr()+
    "City<list><value:San Franciso, CA><value:New York, NY><value:Chicago, IL>"+cr()+
    "Phone"

This example generates a text list object with three choices, all of which contain commas. When you use the <value> tag, you should not include a value in the primary object tag itself.

Width

To customize the width of a single text editor, popup button or list object use the <width:dimension> tag. The width is normally expressed in points (1 point = 1/72 inch) but you can also specify values in inches (1 in or 2.5 inch or 0.75") or centimeters (20 cm).

constructformdataeditors
    "Name"+cr()+
    "Address<lines:3>"+cr()+
    "City"+cr()+
    "State<width:0.5 inch>"+cr()+
    "Zip<width:1 inch>"

The <width> tag overrides the width for just this one object, otherwise the width is set automatically (see Geometry section for more information.

Height

To change the height of a text editor or list object, use the <lines:count> tag. In this example all the fields will be one line high except for the Address field, which will be three lines high.

constructformdataeditors
    "Name"+cr()+
    "Address<lines:3>"+cr()+
    "City"+cr()+
    "State"+cr()+
    "Zip"

The height doesn’t have to be an integer number of lines, but it does have to be at least 1. If the height is more than 3 lines high, a vertical scroll bar will be included in the editor object (of course you can manually remove it at any time).

Objects generated by the <list> tag are normally six lines high, but you can set the height to anything you want.

Numeric Values

The <step>, <min> and <max> tags customize text editor objects for numeric values. Use the <step> tag to automatically generate a stepper object to the right of the text editor:

constructformdataeditors
    "Quantity<step>"+cr()+
    "Description"+cr()+
    "Price"

The step value is normally 1, but you can set it to any numeric value. In this example, the stepper will increment or decrement the price by a nickel each time it is clicked.

constructformdataeditors
    "Quantity<step>"+cr()+
    "Description"+cr()+
    "Price<step:0.05>"

If you set a maximum value, a slider object will also be generated. In this example, the slider can be used to adjust the quantity from 0 to 12.

constructformdataeditors
    "Quantity<step><max:12>"+cr()+
    "Description"+cr()+
    "Price<step:0.05>"

You’d probably want to set a minimum of one, not zero.

constructformdataeditors
    "Quantity<step><min:1><max:12>"+cr()+
    "Description"+cr()+
    "Price<step:0.05>"

Note: Setting a minimum and maximum doesn’t prevent values larger or smaller than this from being typed into the text editor. If that is necessary, you would need to add additional programming.

Field/Variable Label

Each field or variable has a label to the left of it. Normally the text of this label is the same as the field or variable name, but you can specify different text with the <label:text> tag, as shown below. Note that when you specify a custom label, you must include any punctuation before or after the label text (in this example colons).

constructformdataeditors
    "Quantity<label:Qty:>"+cr()+
    "Description<label:Item:>"+cr()+
    "Price"

Normally each label has a colon added as a suffix, but you can change the suffix (<labelsuffix:value>), and also add a prefix if you like (<labelprefix:value>).

constructformdataeditors
    "<labelsuffix:...>"+cr()+
    "Quantity"+cr()+
    "Description"+cr()+
    "Price"

Note: The prefix and suffix are not added when you specify a custom label with the <label:text> tag.

Prompts

You can optionally specify that a prompt will appear when a field or variable being edited is empty. The prompt appears in gray text, and disappears as soon as the first character is entered into the field or variable. Use the <prompt:text> tag to specify a prompt for each line.

constructformdataeditors
    "Quantity<prompt:Number of Items>"+cr()+
    "Description<prompt:Description>"+cr()+
    "Price<prompt:Price>"

If you put an <autoprompt> tag at the top, the field or variable name will automatically be used as the prompt (unless a prompt is explicitly specified). The example below will produce exactly the same form objects as the example above. In this example, the prompts for the Description and Price fields are generated automatically.

constructformdataeditors
    "<autoprompt>"+cr()
    "Quantity<prompt:Number of Items>"+cr()+
    "Description"+cr()+
    "Price"

Note: It’s rarely necessary, but you can also enable and disable automatic prompts by using <autoprompt:yes> and <autoprompt:no>.

Push Buttons

To generate one or more push buttons on a row, use the <button:title> or <buttons:title,title> tags. You can create multiple buttons either with multiple <button> tags or with a single <buttons> tag.

constructformdataeditors
    "Quantity"+cr()+
    "<button:Lookup>"+cr()+
    "Description"+cr()+
    "Price"

The tag can also specify the button width and any code associated with the button, like this:

<button:title:width:code>
<buttons:title:width:code,title:width:code,title:width:code>

The width is normally specified in points, but can also be specified in inches or centimeters.

constructformdataeditors
    "Quantity"+cr()+
    "Description"+cr()+
    "Price"+cr()+
    "<button:Add:60:call addItem><button:Remove:100:call removeItem>"

Code

The code:text> tag defines procedure code for text editor, data button and pop-up menus. If the tag is on the same row as one of these objects, that object will use the specified code.

constructformdataeditors
    "Quantity<code:call adjustQTY>"+cr()+
    "Description"+cr()+
    "Price<code:call adjustPRICE>"

If the <code> tag is on a line with no object on it, that code will be used for all following objects. In this example, the subroutine logUpdate will be called when any of the fields are modified.

constructformdataeditors
    "<code:call logUpdate>"+cr()+
    "Quantity"+cr()+
    "Description"+cr()+
    "Price"

You can change the code at different points, or use <code:> to completely eliminate the code for additional objects.

Tooltips (Help)

The <help> tag defines a tooltip for the current row. The tooltip text will appear when the mouse hovers over this row.

constructformdataeditors
    "Quantity<help:number of items to order (1 or greater)>"+cr()+
    "Description"+cr()+
    "Price<help:List price of this item>"

Font and Size

You can change both the font and size of generated objects. Changing the size is more common, to do that use the <size:points> tag. Normally you would do this just once at the top. This example will generate text objects with text that is 1/3rd inch high (24 points)

constructformdataeditors
    "<size:24>"+cr()+
    "Name"+cr()+
    "Address"+cr()+
    "City"+cr()+
    "State"+cr()+
    "Zip"

You can also specify that the size is regular (13 points), small (11 points) or mini (10 points). Note: Some objects, including checkboxes, radio buttons, and pop-up menus, can only be generated in these three sizes. You can’t make a 24 point checkbox, for example. You can, however, specify these three sizes either numerically or by their names (regular/small/mini).

constructformdataeditors
    "<size:small>"+cr()+
    "Prefix<popup:Mr.,Ms.,Dr.>+cr()+
    "Name"+cr()+
    "Address"+cr()+
    "City"+cr()+
    "State"+cr()+
    "Zip"+cr()+
    "Valid<checkbox:YES>"

Use the <font:name> tag to change the font. If this tag is omitted, the system font will be used.

constructformdataeditors
    "<font:Tekton><size:24>"+cr()+
    "Name"+cr()+
    "Address"+cr()+
    "City"+cr()+
    "State"+cr()+
    "Zip"

Geometry

The tags in this section allow you to change how generated objects are laid out. All of the tags in this section include measurement values. These values are normally expressed in points (1 point = 1/72 inch) but you can also specify values in inches (1 in or 2.5 inch or 0.75") or centimeters (20 cm).

First up is <spacing:distance>. This specifies how far apart the objects are. The default is 2 points, but you can set it to larger or smaller values (even 0, though you probably don’t want to do that. This example spaces the objects 1/12th inch (6 points) apart.

constructformdataeditors
    "<spacing:6>"+cr()+
    "Name"+cr()+
    "Address"+cr()+
    "City"+cr()+
    "State"+cr()+
    "Zip"

The <fieldwidth:distance> tag specifies how wide each text editor object should be. The default is 200 points (just under 3 inches). If the <variablewidth> tag is included, the field width’s will vary, corresponding to the widths in the data sheet. The <labelwidth:distance> tag specifies how wide the labels on the left side are. The default is 120 points.

constructformdataeditors
    "<spacing:6>"+cr()+
    "<size:24>"+cr()+
    "<labelwidth:1 inch><fieldwidth:5 inches>"+cr()+
    "Name"+cr()+
    "Address"+cr()+
    "City"+cr()+
    "State"+cr()+
    "Zip"

The new objects are normally generated starting from 1/2 inch below and to the right of the top left corner of the form, but you can change this to any location. This example starts generating the objects starting at 1 centimeter from the top, and 15 centimeters from the left edge of the form.

constructformdataeditors
    "<top:1 cm><left:15 cm>"+cr()+
    "Name"+cr()+
    "Address"+cr()+
    "City"+cr()+
    "State"+cr()+
    "Zip"

Note: Explicitly specifying the position disables the auto-placement feature that allows you to move generated objects, then regenerate them and have them stay in the new position. Because of this, you’ll usually not want to explicitly set the position with these tags.

Field/Variable Prefix

Sometimes the names of your fields or variables may have a prefix that you don’t want included in the labels. For example, suppose your field names are SubscriberName, SubscriberAddress, etc., and you just want the labels to be Name, Address, etc. You can use the <prefix> tag to generate this.

constructformdataeditors
    "<prefix:Subscriber>"+cr()+
    "Name"+cr()+
    "Address"+cr()+
    "City"+cr()+
    "State"+cr()+
    "Zip"

Constructing Objects for a Dialog

If you are creating a dialog, use the <dialog> tag. This automatically generates Ok and Cancel buttons, and also adds the code necessary for proper dialog operation. If Ok/Cancel is not the buttons you need, you can include a comma separated list of buttons in the tag, like this,

constructformdataeditors
    "<Dialog:New Subscriber,Cancel>"+cr()+
    "Name"+cr()+
    "Address"+cr()+
    "City"+cr()+
    "State"+cr()+
    "Zip"

Buttons will be generated from right to left. You can have 1, 2, 3 or more buttons. You will probably need to adjust the width of the buttons after they are generated.

Removing Existing Form Objects

If the very first item in the template is the <zapform> tag, the form will be cleared before generating the new objects. Be careful with this tag – it will destroy everything in the form before adding the new objects!

Note: Even if you don’t include the <zapform> tag, this statement will clear any objects that were previously generated by this statement. In other words, even if you use this statement multiple times you’ll only end up with one set of generated objects.

Extra Tags

This statement will normally generate an error if it encounters tags that it doesn’t understand. However, if you put the <ignoreunknowntags> at the top of the template, unknown tags will be ignored. This can be handy if you want to create your own tags for other purposes.

Comments

You can include comments to yourself by starting a line with //. Note: Unlike Panorama procedures, you cannot start a comment in the middle of a line.

Comments are handy for temporarily disabling a line in the spec. Just put // at the beginning of the line and everything else in that line will be ignored.


See Also


History

VersionStatusNotes
10.0NewNew in this version.