Previous | Table of Contents | Next

Page 363

property to true will solve this problem. It makes the case irrelevant in database queries performed from the form. It also is a good property to use when your database has mixed character columns.

The Required Property When a block is created, any items in the block that are linked to table columns defined as not null will have their Required property marked true. This will prevent the user from navigating from the item when it is null. On the surface, it seems that this is a good feature. However, I have found that users seem to have a great deal of problems with required fields. For some reason users (including me) place their cursors into these required items by accident, and become frustrated when they can't leave the field. In order to avoid this problem, I always make the Required property on every form text item false.

Understanding Item Types

As you have seen in the previous section, Forms gives the developer the ability to create a variety of item types. Use of these items can enhance the user friendliness of your forms. Some of the more commonly used items are check boxes, images, buttons, radio groups, list items, and text items. The type of item can be specified at the time the block is created by using the Items dialog box. The type can also be easily changed later by using the item's Item Type property. The following sections cover these items.

NOTE
If you have trouble creating and operating any of the following items, a working example containing the items is available on the CD. This form is called EMPCH14X.FMB. You may compare your application to the settings in this form.n

Check Boxes

A check box is a graphical item that displays a box checked when the item contains one value, and unchecked when the item contains another value. This item type is used when the item contains no more than two mutually exclusive values. An example of a data item that can be used as a check box is gender. The values can only be male or female. The values are mutually exclusive.

To create a check box, perform the following steps:

  1. Create an item by using the Layout Editor tool palette, or the New Block dialog box, or the create button on the Object Navigator. Be sure the item type is "Check Box."

  2. Open the item's property sheet. Locate the Functional properties at the bottom of the sheet. Enter a label or description of the item in label property.

  3. Populate the Checked Value property. This should be the value of the item when the box is checked.

  4. Populate the Unchecked Value property. This should be the value of the item when the box is unchecked.

  5. Select the value for the Check Box Other Value. This property determines what the check box will do when the item does not have a checked or unchecked value.

Page 364

  1. Enter the value used in the Checked or Unchecked properties into the Default property.

  2. Format the item on the layout editor.

The following example, as shown in Figure 14.19, consists of changing the payroll_deduct item on the Employee Form from a text item to a check box. You may use the EMPCH14.FMB form that has been used throughout this chapter to practice the procedure.

  1. Open the item's property sheet.

  2. Change the item type to check box. The Checked Value property should be Y and the Unchecked Value should be N.

  3. Change the Label property to Pay Ded.

FIG. 14.19
The payroll_deduct
item property sheet
displaying the check
box properties.



  1. The next step is to open the Layout Editor. The check box items on the block must be rearranged and the size of the item changed.

Figure 14.20 shows the executed form. The first tool record has a checked value, which indicates that the item was purchased on payroll deduction. The second item is unchecked or was paid at the time of purchase.

Radio Group Buttons

A radio group is a set of buttons that identify a value. A radio group is an appropriate graphic object when the item is comprised of two or more mutually exclusive values. Each value is assigned to a specific radio button in the radio group. When the button is depressed or blackened, the item equals the value assigned to the button.

To create a radio button group, perform the following:

  1. Create an item by using the Layout Editor tool palette, the New Block dialog box, or the create button on the Object Navigator. Be sure the item type is Radio Group.

  2. Select the radio group item on the Object Navigator. Expand the item.

Page 365

  1. Select the Radio Buttons object located under the radio group. Create a button object for each possible value in the group.

  2. Open each button's property sheet by double-clicking the button next to the object. Enter a description of the button in the Label property. Assign a value to the button by using the value button.

  3. Open the radio group's property sheet by double-clicking the button to its left. Enter a default value into the default value property.

  4. Open the layout editor and format the various buttons.

FIG. 14.20
The Employee Update
form showing the payroll
_deduct check box.


In the following example, the gender item on block ONE of the Employee Update form is to be changed to a radio group. Figure 14.21 displays the Object Navigator after the gender item type was changed to radio group and two radio buttons were added.

FIG. 14.21
The Object Navigator
displaying the gender
radio group
and buttons.



Page 366

The next step is to add the name of the button and assign a value to the button. This is done on the button's property sheet. The filled-in sheet is displayed in Figure 14.22. The label contains a value of Male and the value property M. The properties are described in Table 14.4.

FIG. 14.22
The Male radio button
property sheet.



The final step is to open the Layout Editor and format the buttons. The background color can be changed and their position moved. Figure 14.23 shows the executed form displaying a female employee.

FIG. 14.23
The Employee Update
form with gender radio
buttons. The female
button is depressed.



List Items

Another very useful device is a list item. It is a graphical device that displays a fixed set of values for the user to select. A list item is used when the item contains a number of defined values not likely to change. I generally use this device when the item contains between 3 and 15

Previous | Table of Contents | Next