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.
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 |
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:
Page 364
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.
FIG. 14.19
The payroll_deduct
item property sheet
displaying the check
box properties.
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.
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:
Page 365
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.
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