Using Forms

Description

Forms provides a detailed, one-record-at-a-time view of data in a table or set, and are most commonly used for data entry. Forms also make it easy to enter and modify data stored in multiple tables in a database. In this lesson, you learn how to create and use basic Forms.

Working With Forms

In addition to the Default Browse for entering data, Alpha Anywhere also provides a Default Form that you can use for data entry. Working in Form view is like working in browse view; you can perform the same operations, including entering, editing, deleting, and sorting records. The toolbars are very similar and the menus offer most of the same features. In form view, you can use the same navigation options to display and navigate records, that you use in Browse view.

Using the Form Editor

In the first procedure, you examine a Default Form in AlphaSports and modify it using the Form Editor. Using the Form Editor, you can insert fields, display calculations, and add graphics and other design elements. To open an AlphaSports Default Form :

  1. Open the AlphaSports database.

  2. In the Control Panel, right-click on the Customer table, and select Open Default Form from the right-click menu. The Customer table Default Form appears.

    • The Default Form displays the field values of one record, with each field on a separate line.

      Press F8 to switch between form view and browse view.
    images/customerDefaultForm.gif
  3. Click the following or select Form > Design Mode.

    images/Design_Mode_button.gif
  4. The Customer Default Form appears in the Form Editor.

    • The Form Editor displays the Form fields and field names arranged in a vertical layout.

    images/formEditor.gif
  5. In addition to the Form Editor, the Toolbox appears. If the rulers are not present, select View > Rulers to display them.

  6. To aid in form design, select Form > Grid. The Grid dialog box appears.

    images/Grid_Dialog_box.gif
  7. Select Show Grid, and click OK.

Using the Form Design Toolbar

The Form Design toolbar contains commands and options that let you create and modify the structure and appearance of a form.

images/FormDesignToolbar.gif

The following table describes the functions of the Form Design toolbar buttons.

  • Display table records in Form view.

    images/Form_View_Button.gif
  • Create a new Form.

    images/New_Query_button.gif
  • Open an existing Form.

    images/Folder_button.gif
  • Save the Form layout.

    images/Save_button.gif
  • Print Form data.

    images/Print_button.gif
  • Preview Form data.

    images/Preview_Form_button.gif
  • Define print settings; for example, printer, # of copies, and page orientation.

    images/Print_Properties_button.gif
  • Remove the selected information (cut) and copies it to the clipboard.

    images/Cut_button.gif
  • Copy the selected information to the clipboard.

    images/Copy_button.gif
  • Insert (paste) clipboard contents at the cursor position.

    images/Paste_button.gif
  • Delete the selected object(s).

    images/Delete_button.gif
  • Undo an action.

    images/Undo_button.gif
  • Redo an action.

    images/Redo_button.gif
  • Define Form or object properties.

    images/Properties_button.gif
  • Define Form or object events.

    images/Event_button.gif
  • Display rulers.

    images/Ruler_button_2.gif
  • Display Toolbox floating toolbar.

    images/Toolbox_button.gif
  • Display DragDrop List window for inserting objects on the Form.

    images/Drag_and_Drop_List_button.gif
  • Toggle Text Toolbar on and off.

    images/Toggle_text_button.gif
  • Toggle Border Toolbar on and off.

    images/Toggle_border_button.gif
  • Toggle Arrange Toolbar on and off.

    images/Toggle_arrange_button.gif
  • Toggle Copy Format Toolbar on and off.

    images/Toggle_copy_format_button.gif
  • Group selected objects together as a single unit.

    images/Group_button.gif
  • Un-group selected object(s).

    images/Ungroup_button.gif
  • Create or modify calculated fields.

  • Create or modify variables.

    images/Variables_button.gif
  • Display the Control Panel.

    images/Control_Panel_button.gif

In the following procedures, you learn to move, edit, delete, resize, format, and add Form objects.

images/Field_Object_commented.gif

Editing the Default Form

To edit a form object, you must first select it by clicking on it. When you select an object, selection handles appear, small black boxes in each corner and one at the center of each side. You can select more than one object by using one of the following procedures.

  • Holding down the Shift key while clicking the objects.

  • Holding down the left mouse button and dragging to draw a rectangle (lasso) through or around the objects.

  • Select all objects on the form, by selecting Edit > Select All, or pressing Ctrl+A.

To edit the Customer Default Form :

  1. Open the form, and click the button on the toolbar. The Customer Default Form appears in the Form Editor. In modifying the Default Form, you arrange the form fields into two columns. In the next steps, you resize the form to accommodate both columns.

    images/Design_Mode_button.gif
  2. Position your cursor over the right edge of the Form Editor window. The cursor becomes a two-headed, horizontal arrow.

    images/resizeForm.gif
  3. Click and drag the right edge of the window to the right, past the eight inch mark on the ruler.

  4. Position your cursor over the right edge of the form.

  5. Click and drag the right edge of the form to about eight inches, to widen the form.

  6. Click on the Customer ID field. If the objects are grouped, selection handles appear around the Customer ID field and title.

    • images/custIDfield.gif
    • Note that when the fields are grouped, and you click a second time on one of the fields, black selection handles appear around the object you clicked, and grey selection handles appear around the other object or objects.

      images/custIDfieldSemi.gif
    • You have selected an individual object within the group. You can then right-click on the individual object, and examine its properties and events. This is called drilling down within a group. If you right-click on a group of objects, you can only examine the properties common to the group. If you ungroup and then select both label and field, black selection handles appear separately around each object.

      images/custIDfieldUn.gif
    images/custIDfield.gif

You can specify the following Alpha Anywhere setting to group fields and titles, however, this setting has no effect on the current form.

  1. Select View > Settings.

  2. Expand the System settings, and click Styles.

  3. Select Forms under Layout Type, and select Automatically Group Fields & Titles.

  4. Click OK. Use the Shift key to group the fields and titles that you reposition in the following steps.

  5. Click on the grouped Customer ID field and title text, and drag them to the upper right corner of the form.

  6. To move a field in small increments, press the Shift key and use the Up and Down arrows.

  7. Using the following screen shot as a guide, select the fields and move them to new locations.

    images/formEdit1.gif
  8. Select Edit > Select All, and click Arrange > Ungroup (or on the toolbar). The field and label title objects appear selected separately.

    images/Ungroup_button.gif
  9. Delete the field title objects for Bill Postal Code and Bill Country, by selecting them, and pressing the Delete key.

  10. Place the data fields next to the Bill State/Region field.

    images/formEdit2.gif
  11. Repeat steps 9 and 10 for the Shipping Postal Code and Country. Leave space near the top of the form for a title, and in between the billing address group of fields and the shipping address group. In the next steps, you edit and resize a text label object.

  12. Double-click on the Billing Address? text field. The text becomes highlighted and editable. You can also make text changes by right-clicking on the text object, and selecting Properties from the right-click menu.

  13. Enter "Shipping Same as Billing?". In the next step, you enlarge the text field to accommodate the new label text.

  14. Select the Shipping Same as Billing label field. Selection handles appear around the object.

  15. Position the cursor over the left-side selection handle. The cursor becomes a two-headed, horizontal arrow.

    images/fieldEditText.gif
  16. Click and drag to the left, to enlarge the text field.

  17. Click Save, enter the name "CustomerList", and click OK.

In the next sections, you use other Design toolbar options to align, format, and add a new object to the Form.

Aligning Objects

The Align Positions, Align Sizes, and Align Spaces commands, also found in the Arrange menu, let you align multiple objects' positions, sizes, and spaces. You access the Arrange Toolbar by clicking the Toggle Arrange Toolbar button . The Arrange Toolbar appears below.

images/Toggle_arrange_button.gif
images/arrangeToolbar.gif

The Align Positions command has the following options. When two or more objects are aligned, the first selected object stays put, and the others move into alignment with it.

  • Left

    Align selected objects to the left edge of the first selected object.

    images/Align_left_button.gif
  • Right

    Align selected objects to the right edge of the first selected object.

    images/Align_right_button.gif
  • Top

    Align selected objects to the top edge of the first selected object.

    images/Align_Top_button.gif
  • Bottom

    Align selected objects to the bottom edge of the first selected object.

    images/Align_Bottom_button.gif
  • Center width

    Move selected object horizontally, so they are centered using the first selected object as the point of reference.

    images/Align_center_button.gif
  • Center height

    Move selected object vertically, so they are centered using the first selected object as the point of reference.

    images/Align_Ver_Center_button.gif

The Align Sizes command has the following options. When you size two or more objects, the first selected object stays the same, while the rest change.

  • Width

    Resize objects so they are as wide as the first selected object.

    images/Align_width_button.gif
  • Height

    Resize objects so they are the same height as the first selected object.

    images/Align_Height_button.gif
  • Size

    Resize objects so they are the same size as the first selected object.

    images/Align_Size_button.gif

The Align Spaces command has the following options. When you adjust spacing between objects, the spacing between the first two objects remains the same, while the others are moved.

  • Horizontal

    Move objects horizontally, creating an equal amount of space between them, left to right.

    images/Horizontal_Spacing_button.gif
  • Vertical

    Move objects vertically, creating equal space between them, top to bottom.

    images/Vertical_Spacing_button.gif

To align form objects:

  1. Open the AlphaSports database.

  2. In the Control Panel, select the Forms tab.

  3. Right-click the "CustomerList" form, and select Design from the right-click menu. The CustomerList form appears in the Design Editor.

  4. Click the Toggle Arrange toolbar button. The Arrange Toolbar appears.

  5. Hold down the Shift key and select the following label text fields: First Name, Last Name, Bill Address 1, Bill Address 2, Bill City, and Bill State/Region.

  6. On the Arrange Toolbar, click the Right Align button . The selected label fields appear aligned by their right edges.

    images/Align_right_button.gif
  7. Select the corresponding field objects, and click the Left Align button . The selected label fields appear aligned by their left edges.

    • images/Align_left_button.gif
    • images/formEdit4.gif
    • Similarly, right and left align the Company, Phone Number, Fax Number, and Shipping Same as Billing? label text fields and field objects.

      images/formEdit3.gif
    • In the next procedure, you add a title and border to the form.

Creating Form Objects

First, you use the Toolbox floating toolbar to create a title text object for the form, then you use the Text Toolbar to format its appearance. The Text Toolbar is a shortcut for some commonly used formatting options. To access all the options, right-click on the object, and select Properties. The Toolbox is a floating toolbar that contains buttons representing the objects you can place inside a form. You can also select Object > New to select and create an object for a form. To display the Toolbox :

  1. Click the Toolbox button on the Toolbox, or select View > Toolbox.

    • The following image shows the Toolbox, which has the same functionality.

      images/GS_Toolbox_V6.gif
    • The following table lists the Toolbox tools and describes their function.

    images/Toolbox_button.gif

In the next procedure, you add a form title, in the top area of the CustomerList form, by adding and formatting a text object. To add a form title:

  1. Open the CustomerList form in Design Mode. The CustomerList form appears in the Design Editor.

  2. Click the Toolbox button, or select View > Toolbox. The Toolbox floating toolbar appears.

  3. If you do not have space at the top of the CustomerList form, select the Vertical Shift tool.

  4. The Horizontal Shift and Vertical Shift tools let you insert space in your layout by moving groups of objects horizontally or vertically.

  5. Click above the First Name field in the form, and drag the fields downward.

    • The Vertical Shift tool selects and moves all the fields below the bar downward. The Vertical Shift tools select the fields in the direction of the first mouse movement. Nudge downward to select fields below the Vertical Shift tool bar, or upward to select fields above the bar. Once selected, you can move the fields in the opposite or same direction. Another way to select and reposition multiple fields at one time, is by using the rulers. When you left-click in the top or side ruler, a line appears on the form. The line selects and can move all the objects it touches. If you right-click in a ruler, you can use the right-click menu options to align the objects that the line touches.

    images/verticalShift.gif
  6. Select the Text object tool from the Toolbox, and position the mouse pointer in the Form Editor window. The mouse pointer becomes a cross-hair connected to the letter A.

  7. Draw a rectangle with the tool, to establish the location and dimensions of the text object. When you release the mouse button, the cursor is positioned inside the text object, where you can enter the title text.

    images/titleText.gif
  8. Enter the text "Customer List" and click outside the text object frame.

  9. Click the Selection tool on the Toolbox, and select the text object. Selection handles appear around the title text object.

  10. Click the Text toolbar button to display the Text Toolbar.

    images/UG_Text_Toolbar.gif
  11. Set the font to "Arial", and font size to "24".

  12. Click the B button to make the text bold.

  13. Click the Align Center button.

    • Alternatively, you can right-click on a text object, and use the Properties dialog box to designate font, size, and style. You access more options by using the Properties dialog box.

    images/titleTextFormatted.gif
  14. Click the Border toolbar button to display the Border Toolbar.

    images/UG_BorderToolbar.gif
  15. With the title text object selected, click the Single-line Border button. A border appears around the title text object.

  16. From the Toolbox, select the Frame object.

  17. Draw a rectangle around the shipping address fields. A frame appears.

  18. Click Save.

  19. Click the Form View button on the Design Toolbar to see the finished form.

    • You will enhance forms with other objects in later lessons. In the last exercise, you learn how to create a new Custom Form.

    images/FORMEDIT5.GIF

Creating a New Form

In the next procedure, you create a custom form for AlphaMovies using the New Form Genie.

You should have already created the AlphaMovies database in the Creating a Database lesson.

To create a new form:

  1. Open the AlphaMovies database.

  2. In the Control Panel, click the Forms tab, and click New. The New Form Genie appears.

    images/newForm1.gif
  3. First, you select the table or set on which to base the Form.

  4. Select the "Inventory" table, and click Next.

    images/newForm2.gif
  5. Next you select the form type to create. You can choose from three Form types, described in the following table.

    • Blank

      A new form without any objects appears in the Form Editor.

    • Default Form

      A new form with all table/set field objects appears in the Form Editor.

    • Custom Form

      A new form appears in the Form Editor. This option lets you select the form layout style and field objects.

  6. Select Custom Form and click Next.

    images/newForm3.gif
  7. In the Layout Style drop-down list box select "Multi-Column" and in Number of Columns select "2". Picture

    images/newForm4.gif
  8. Now you can select the fields for each column. For "Column 1", select "Title", "Genre", "Language", "Rating", and "Runtime".

    images/newForm5.gif
  9. For "Column 2", select "TapeID", "Availability", and "Sale Price", and click Next.

  10. You can select a style for the form from a list of predefined styles in the Stylesheet list. Preview the styles and select one you like.

  11. Click Next, and then click Finish. Your custom form appears in the Form Editor.

    images/newForm7.gif
  12. Click the Save button, and enter the name "InventoryList".

  13. You can click the Form View button to see the finished product, or further edit your form using the Form Editor.

Summary

In this lesson, you learned how to edit and create a basic Form. You worked with a Default Form, and learned how to move, edit, delete, resize, format, and add form objects. You learned how to use the Design toolbar, the Text, Border, Format, and Arrange toolbars, and the Toolbox floating toolbar, when working with form objects. You learned how to select, move, and align multiple form objects, and how to access object properties using the Properties dialog box. You created a new Custom Form. Using the New Form Genie, you selected fields, specified a layout, and applied a stylesheet.

See Also