• No se han encontrado resultados

RICARDO CARAPETO GARCÍA

In document La AEMPS en cifras (página 45-50)

7.3 A

DDING

C

ONTROLS

This section gives a few examples of how to add controls without using the form wizards.

The Toolbox

You use the Toolbox to insert controls. The Toolbox is opened by choosing Toolbox from the View menu. You select a specific tool by clicking the corresponding icon.

Note that some of these tools are not implemented in the present version of C/SIDE, but that the icons are already present

they will, however, always appear disabled.

When you click the Pointer tool, the state changes from insertion to selection. You can use this if, for example, you change your mind about inserting a control.

The Lock tool locks the current control selection. Normally, after you have inserted a control, you have to select the type of control again before inserting the next control.

You can continue inserting controls of the same type without having to select the tool again and again by turning Lock on (it is a toggle).

If Add Label is on (it is a toggle), all controls will have a label when you insert them.

Adding a Text Box

If text boxes are related to database table fields, the easiest way to add them to a form is to use the Field Menu. The Field Menu is a list of all fields in the table that is defined as the SourceTable for the form. You can open the Field Menu in the Form Designer by clicking View, Field Menu. A text box that has a specific field in the table as its SourceExpr (that is, has this field as its underlying table field) can be added to the

Text Box

To add a text box:

1 Open the form in the Form Designer.

2 Click View, Field Menu to open the Field Menu window:

3 In the Field Menu window, select the field or fields. The Field field contains the Name property, and the Caption field contains the Caption property. For more information about these properties, see Chapter 18, "Multilanguage Functionality".

When you move the cursor into the design area, it will change into the Control Insertion cursor.

You need to activate the Form Designer window, for example, by a mouse click

,

before the cursor will change into the Control Insertion cursor.

4 Click in the design area for each selected field to insert a text box at the cursor position.

If you selected more than one field, the text boxes will be inserted and aligned in a column below the mouse position.

Each text box has these characteristics:

· It has the table field as its SourceExpr.

· The default settings for the Name and Caption properties are the same as the setting for the Name property of the underlying table field.

· In general, all properties that are both field properties and text box properties have the value of the field property in the underlying table as a default value.

· The text box has a label with a caption that defaults to the caption of the text box.

The advantage of using the Field Menu to add text boxes with labels is that you are effortlessly assured that naming and properties are consistent.

Beware that if the data type is anything but boolean, a text box will be created automatically. If the data type is in fact boolean, a check box will be created.

7.3 Adding Controls

Adding a Text Box without Using the Field Menu

Although the easiest way to add a text box is by using the Field Menu, you can add text boxes without using the menu. This is the way to add a calculated text box, that is, a text box that is used to display a calculated value. It is also possible to add an unbound text box and then, later on, bind it to a table field.

To add an unbound text box:

1 Open the form in the Form Designer.

2 Select the Text Box tool.

3 Move the cursor into the design area.

4 Click to add a text box of the default size, or click and drag to create a text box with a different size.

Now you have an unbound text box control on the form. Notice that no characteristics were inherited and that the text box has no label.

The subsection Changing the Properties of a Control on page 125 explains how you can bind the text box to a table field and add a label, and the subsection Displaying a Calculated Value on page 129 tells how you can use the text box to display a value that is calculated on the fly.

Creating Labels That Display Descriptive Text

You can add a label that is not the child of another control to a form. You can do this, for example, if you want to have a descriptive text on the form– it could be instructions about using the form or other information that is static and not related to any database table field.

To add a label:

1 Open the form in the Form Designer.

2 Select the Label tool.

3 Move the cursor into the design area.

4 Click to create a label of the default size, or click and drag to create a label of a different size.

5 As the label is not part of a control branch, it will be given a default name and caption (like Control4). You can change the name and the caption on the Property

In document La AEMPS en cifras (página 45-50)

Documento similar