Log In    |    Knowledge Base    |    4D Home
Tech Tip: Adding a field to a form
Published On: September 1, 1998

There are several ways to add fields to an existing form. Most developers click on the Add Field Tool in the Tool Palette and draw a rectangle that corresponds to the size of the field that they want. This has the advantage of controlling the dimensions of the field, but is cumbersome. The field will typically be formatted to a default system font, normally 12 point Chicago. Most forms no longer use the Chicago font, so this will have to be changed. The field that is added will be the first field in the table that the form belongs to, so this will typically need to be changed as well. One of the new, and under publicized, features of 4D version 6 is the ability to drag an object (usually a form, but it works for fields as well) from the Explorer and drop it on a form. This is usually easier than drawing the rectangle for the field, but the font and style will still need to be modified. It has the advantage of allowing a specific field to be added, rather than the first field in the table. The dimensions of the field are generic, and correspond to a typical alpha field; however, no allowance is made for the maximum length of the specific field, so the rectangle may need to be occasionally redimensioned. Perhaps the best way to add a new field to a form is to click once on a similarly sized field to select it, then choose the Duplicate menu item from the Object menu. This will create an exact duplicate of the field, so it will need to be modified into the desired field. The advantage of this method is that all of the style and font attributes of the original are included with the new field, so there are fewer modifications to make. Remember that object methods will also be copied over, so these may need to be cleared.