"SBase Personal - 33. GETTING TO KNOW THE FORM DESIGNER" 33 GETTING TO KNOW THE FORM DESIGNER Use of External Fields Designing Screens Designing Forms for Printing Starting the Form Designer Relationship to SBase The Form Designer Menus The Toolbox Opening a Form Selecting Objects Selecting a Single Object Selecting a Group of Contiguous Objects Selecting a Group of Discrete Objects Deselecting an Object Selecting an Object for Moving or Sizing Creating a Form Where To Go From Here 33 GETTING TO KNOW THE FORM DESIGNER The Form Designer is a design system for producing input and browsing screens, forms for printing, and in SBase Professional 4 generate complex reports. The user combines graphic, data, and logical objects together using a range of editing tools and techniques. The resulting form may then be opened from within the database. In SBase Personal 4, the form design system is called Form Designer. Form Designer allows you to layout input screens as well as hard copy output. The form design system in SBase Professional 4 is called Form Designer Pro. This system has all the features of the Form Designer in SBase Personal 4 plus the ability to utilize DML commands within a Form to produce complex reports. In Chapters 34 through 46, any reference to Form Designer implies the described feature is common to both the Personal and Professional versions of SBase 4. Whenever the feature described occurs only in the Form Designer Pro of SBase Professional 4, it will be indicated. Note Forms created in the Form Designer Pro of SBase Professional 4 cannot be opened in SBase Personal 4. It is however possible to open forms created in the Personal 4 product by the Professional 4 product. To do so, you will have to rename the form manually in the Shell. This is because the Form Designer of the Personal 4 product assigns the extension S2V while the Form Designer Pro assigns a file extension SBV to forms created in the Form Designer Pro. Thus to open a form created in the Personal 4 product, it should be renamed "Filename.SBV" instead of "Filename.S2V". The facilities in the Form Designer are designed to match its role as a complementary program to SBase itself. Its primary purpose is to generate forms for use in database applications. Forms provide the highest level of database design surface in the SBase system, allowing users to construct complete applications with little or no need for programming knowledge. Forms usually consist of a background of graphic objects such as areas and lines, onto which fields from one or more existing database files may be placed. It is also possible to place graphic images on the form such as a company logo to enhance its appearance. Graphic images that can be displayed are the same type as External files. The difference is they are associated with the form file and not the database itself. Graphic images can thus be: IFF PCX GIF EPS (Illustrator format only) ANIM (SBase Professional 4 Only, only first frame is shown on Form) When you enter data into a form which includes fields from more than one file, SBase automatically creates the correct set of records for all the files. This is also possible where one file holds multiple records in relation to a single record in another file. Pages are the building blocks of forms. You may create multi-page forms, and save the individual pages separately as a library of designs. Use of External Fields One of the most powerful uses for SBase is the ability to organize files generated by other programs. For example, it can be used to organize sound sample files, image files or even, in SBase Professional 4, ANIM files. With the ability to develop custom applications with the DML language of SBase Professional 4, very sophisticated programs can be written using SBase Professional 4 which utilize external files. Applications can be developed that go way beyond simply organizing the images and sound files but actually utilize these files. For example, creating a company ID database or recited warnings during data entry. In SBase Professional 4, a full ANIM can be played to illustrate, inform or entertain as a way to convey the data. Designing Screens Screen design is always geared to a specific part of a specific application. The Form Designer allows you to create any number of forms for use with a single file or set of files. The files with which a form is to be used must be set up within the database before you can create the form. In a typical application, you will require at least one form for data entry. If more than one person will be entering or editing data, you may prefer to create separate forms for each person. Each form can show just a selection of the fields from a file, so you can build in protection for your data by excluding sensitive fields where necessary. In addition, you may designate any field on a form as either Read Only or Display Only, thus preventing it from being changed or printed out, as appropriate. Files in the database may have up to three levels of password protection. Many applications include a `one-to-many' relationship between two files. The Form Designer allows you to define an area of a form as a block of repeating fields. Each group of fields represents a `transaction' - one record in the file on the `many' end of the one-to-many relationship. Both in data entry and in browsing, such a form provides the ability to manage sets of related records from multiple files without the need for programming. Browsing forms may well be different from data entry forms. They may be designed for on-line querying of a database, with the option to produce an instant printout. `Relational browsing' is a term sometimes used to describe browsing with a multi-file form. You may step through or look up the records in any of the files involved in the form, and SBase will retrieve all related records. Designing Forms for Printing The Form Designer achieves a high degree of page fidelity. You can choose the physical size of your page from the sizes available from your printer driver. The arrangement of objects on the form may use absolute physical measures of inches or centimeters, derived from the Ruler and Grid feature. One inch on the ruler will normally equal one inch on the printed page. This degree of fidelity allows you to design a full range of office stationery with the Form Designer. If you wish, a screen form may be the same as the form that is printed. The inexperienced user may be assigned to enter data from paper forms that are identical with the screen. Likewise, data to be distributed may be viewed in the same format in which it is actually printed. Starting the Form Designer The Form Designer program is called SBFD, while the Form Designer Pro is called SBFDPRO. You may start either program from Workbench like any other Workbench application by clicking on its icon. Once a form is created, you can open the form along with Form Designer from within SBase 4. - Forms should be stored in the same directory as the files they use. You will usually change to this directory when you open a database file from which to select fields. Relationship to SBase You may also run the Form Designer from within SBase. 1. Select Modify Form from the Project menu. - If a form is already open in SBase, the Form Designer opens it ready for editing. When you reactivate SBase, it checks to see whether the form it has in memory has changed on disk. If it has, SBase reloads the form. This allows you to save the form you have been editing, and simply return to SBase to use the new version of the form. The Form Designer Menus *** See Fig 33-1 *** Together with the Toolbox described in the next section, the Form Designer menus contain all the commands for controlling the system. This User Guide assumes you are familiar with the SBase system, and hence Workbench itself, so we do not repeat here explanations of how to use menus, requesters, and other controls. These topics are all covered either in earlier chapters or in your Amiga documentation. Project Menu. The Project menu commands allow you to open, close, remove, and save forms. Two commands give access to SBase database file definitions, and a group of housekeeping commands provides for status reporting, form printing and directory listing. Edit Menu. This menu complements the familiar Cut and Paste commands with a set of editing aids, including Snap to Grid and Crosshairs. Page Menu. The Page menu contains the commands for managing pages, which are the building blocks for forms. Define Menu. A set of commands for selecting text font, setting up links between database files, specifying transaction blocks and defining data entry order. Report Menu. (Only in Form Designer Pro of SBase Professional 4). The special commands for creating a report from and generating the code for a Form Designer Pro program to be executed in the database. The Toolbox The Form Designer toolbox is the most important resource for the application designer. You select from a range of graphic, data, and logical object types, then click to place an object on the form. Objects may have many different attributes, from Read Only status to pattern and color. Tools are provided for moving and sizing objects. See Chapter 34 The Toolbox for more details. Opening a Form Some model forms have been supplied with your example data. To see what a form looks like, open one now. 1. Select the Project Open Form command. 2. When the requester appears, change to the directory in which you have placed the example files. 3. In the left-hand list, click the file Clients. The Form Designer opens and displays the form. You may now use the Form Designer's full range of tools to experiment with and modify this form. If you wish you may save your experiments under different names and use them in SBase. If you are running Form Designer under AmigaDOS 1.3, the form selection requester will appear as shown below. *** See Fig 33-2 *** For users of AmigaDOS 2.0, the form requester will appear as follows: *** See Fig 33-3 *** Selecting Objects An important principle in the Form Designer is that an object should always be selected before you may operate on it. The converse is also true, that any operation works on the selected object. You should understand selection techniques at an early stage. Selecting a Single Object Point to the object you wish to select. Double-click the mouse button. The Form Designer outlines the selected object with a line of dashes. Note The dashed line around a selected object differs from the dotted line that surrounds fields. Selecting a Group of Contiguous Objects Hold down the Control key and click the mouse button. Hold it down, and drag a box around the group of objects you wish to select. Release the mouse button and the CTRL key. The Form Designer outlines all the selected objects with dashed lines. It is also possible to select a single object with this method as well. Selecting a Group of Discrete Objects Holding down the SHIFT key, click the objects you wish to select. As you click each one, the Form Designer outlines it with dashes. Deselecting an Object You may deselect an object in two ways: - Press SHIFT while you click on the selected object. - Select another object. Selecting an Object for Moving or Sizing Moving and Sizing are such frequent operations that the selection process has been simplified. To move a single object: 1. Click the four-way arrow tool in the toolbox. 2. Point to the object you want to move. 3. Click the left-hand mouse button and hold it down. 4. Drag the object to its new location. 5. Release the mouse button. To size a single object: 1. Click the sizing tool in the toolbox. 2. Point to the object you want to size. 3. Click the left-hand mouse button and hold it down. 4. Drag the object to its new size. 5. Release the mouse button. Note: If object to be re-sized is an image file you will be given a dialog box to alter the mapping options or even the file mane. Creating a Form For users who feel confident enough to begin creating forms at this point, the following summary procedure provides a shortcut into the functionality of the Form Designer. 1. Select Project New to clear the work area if necessary. 2. Select the Open SB File command on the Project menu. 3. Select the SBase database file for which you wish to create a form. - Restrict yourself to a single file to begin with. 4. Select Auto Field Names and Snap to Grid on the Edit menu. 5. Define a grid with the Edit Ruler/Grid command. - Turn on the Characters check box. 6. Click the Field object type (FLD) in the toolbox. 7. Click where you want to place a field. - Leave enough room for the field name on the left. 8. Select a field from the list of fields, and click OK. - Repeat steps 7 and 8 for each field. 9. Click the round cornered Area object type on the toolbox. 10. Choose a color by clicking the center of the color selector in the middle of the toolbox, then clicking a color from the color palette. 11. Click above and to the left of the top field on the form, drag the outline to surround all the fields, and release. 12. Save the form with the Project Save command. You may now exit from the Form Designer and open the form from within SBase. The form will automatically open any files it requires. Where To Go From Here The rest of this User Guide covers all the tasks the forms designer must become familiar with. The next two chapters cover the Toolbox and the basic procedures for designing and editing forms. The following six chapters go through the data related and logical components of forms design. Chapter 42 Generating Reports explains how to design report forms. in Form Designer Pro. A command summary for both Form Designer and Form Designer Pro is provided in Chapter 46.