• No results found

153Form Properties

In document NavDoc (Page 165-171)

Designing Forms

153Form Properties

The following table briefly describes the some of the more important form properties.

There is a description of all the properties in the C/SIDE Reference Guide online Help.

You can get context-sensitive Help by opening the form's Properties window, placing the cursor on a property, and pressing F1.

Property Name Use this property to...

ID set the numeric ID of the object.

This property can also be set when you save a form. The ID must be unique among forms. Your Microsoft Certified Business Solutions Partner can tell you the number range that you can use.

Name give the form a descriptive name.

No two forms can have the same name.

Minimizable specify whether you can minimize the form window.

Maximizable specify whether you can maximize the form window.

Sizeable specify whether you can resize the form window.

SavePosAndSize specify whether information about the user-made changes to the size and placement of a form window are saved.

If it is set to Yes, this information is saved, and the next time the window is opened, these values are used. Otherwise, the designed values are used.

Editable specify whether you are allowed to edit controls in the form. If it is set to No, controls may not be edited, even when their individual Editable properties are set to Yes.

InsertAllowed specify whether the form can be used to insert records in the database.

ModifyAllowed specify whether the form can be used to modify records in the database.

DeleteAllowed specify whether the form can be used to delete records from the database.

CalcFields specify a list of FlowFields that you want the system to calculate when the form is updated.

If the FlowField is a direct source expression, it is automatically calculated.

However, if it is indirect (part of an expression) it is not.

UpdateOnActivate specify whether you want the system to update the form when it is activated.

SourceTable specify the source table of the form.

Normally, you specify the table when you first create the form. If you have created a form without an underlying table, you can enter a table name here to bind the form to a table.

SourceTableView create a view (what you can see) of the source table for this form. You can specify the key, sorting order and filter that the system will use.

SaveTableView specify whether the system will save information about which record the user is viewing when the form is closed, the sorting order and the current filter, and then reapply this information when the form is opened again.

Chapter 10. Designing Forms

154

General Properties for Controls

The following table briefly describes those properties that are common to several types of controls. There is a description of all the properties in the C/SIDE Reference Guide online Help. You can get context-sensitive Help for a property by opening the Properties window for a form, selecting a control, placing the cursor on a property and pressing F1.

Property Name Use This Property to...

ID set the numeric ID of the control.

The system assigns a sequential number by default. If you delete a control, and then add another in its place, you may want to give the newly created control the number of the one you deleted. The ID must be unique among controls and menu items on the form.

Name give the control a descriptive name.

Caption specify the text that the system displays for this control.

HorzGlue to anchor a control horizontally on the form.

You can choose Left, Right or Both. If you choose Both, the control is resized when the form is resized.

VertGlue to anchor a control vertically on the form.

You can choose Top, Bottom or Both. If you choose Both, the control is resized when the form is resized.

Visible specify whether the control is visible when the form is opened.

This property can be changed from C/AL at runtime. Notice that if the control is a child control and the parent has Visible = No, the child will not be visible, even if it has Visible = Yes.

ParentControl specify the ID of a parent control, thereby turning the control into a child.

10.2 Types of Controls

155

10.2 T

YPES OF

C

ONTROLS

This section contains a brief overview of all the controls that can be added to a form.

The following list is structured according to the broad categories into which controls can be grouped.

Static controls

Static controls are used to contain and display descriptive or graphical information.

You cannot change the contents of static controls at run time.

The static controls are:

Label A label is used to display text, most commonly the caption of another control.

In this situation the label is normally (and conveniently) a child of the other control, but labels can also be used as stand-alone controls.

Image An image control is used for displaying a picture.

Shape A shape is a graphical element (line, circle, rectangle and so on).

Data controls

Data controls display the value of a C/AL expression, for example the value of a table field or a variable or a "real" expression. (The simplest expression is just the name of a table field or a variable.) The valid combinations of data control and data type are:

Data controls must have a relation to data, defined as their SourceExpr property.

Containers

Container controls are used to group other controls together. Some properties of the container overrule the same property in the contained controls. If the container is not editable, then none of the contained controls can be edited (even if they individually have the Editable property set to True).

Frame A frame is simply a rectangle into which other controls can be “dropped”. In the Form Designer, the frame and the controls that it contains can be moved together.

A frame can have different border styles and colors than the form that it is part of.

Tab Control A form can be thought of as a book that contains several pages, or frames. Only one of these pages is visible at a time. You can switch between the pages by clicking on the tabs.

Control Valid data types

Check Box Booleans and BLOBs

Option Button All, except BLOBs

Text Box All

Picture Box Boolean, option, integer and BLOBs

Indicator Integer, decimal, date, time

Chapter 10. Designing Forms

156

Data Containers

Table Box A special kind of container that holds repeated data controls and is used to create columnar tables. Each data control contained by the table box constitutes one column for which a static control is used as a heading. The rows arise from vertically repeating each data control. If the table box displays records from a table, each row displays one record.

Other Controls

Command Button A command button is not related to data. It performs an action when it is clicked, or when ENTER or the spacebar is pressed while the button has the focus.

Menu Button A menu button can be clicked just like a command button, but it does not perform an action. When you click it, a menu opens containing a number of menu items that you can choose.

Menu Item The lines in a menu that can be chosen are called menu items. Each menu item resembles a command button because it can perform an action when you click it.

Subform A subform control is used to display a second form in a control on a form (a main form). This allows the main form to show data from two different tables. For example, the main form could be a card form and show records from a customer table, while the subform could be a tabular form and show details about any purchases the customer has made.

10.3 Adding Controls

157

10.3 A

DDING

C

ONTROLS

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

The Toolbox

You use the Toolbox to insert controls. To open the toolbox, click View, Toolbox or click the Toolbox button on the toolbar. You select a specific tool by clicking the corresponding icon in the toolbox.

Note that some of these tools are not implemented in the current version of C/SIDE, but that the icons are already present– they will, however, always appear disabled.

You use the Pointer tool to select controls on a form in the designer. When you select any of the other tools, the cursor changes from a selection tool to an insertion tool.

Normally, after you have inserted a control, you must select the control again in the toolbox before inserting the next control. However, the Lock tool maintains the current control selection and you can continue inserting controls of the same type without having to select the control again in the toolbox.

If the Add Label tool is also selected, all the controls that you add to the form are given a label when you insert them.

Adding a Text Box

If the text boxes that you want to add to the form are related to database table fields, the easiest way to add them is to use the Field Menu. The Field Menu is a window that lists all the fields in the table that has been defined as the Source Table for the form.

You can open the Field Menu in the Form Designer by clicking View, Field Menu.

To add a text box that has a specific field in the table as its SourceExpr (that is, has this field as its underlying table field) to the form:

1 Open the Form Designer.

2 Create a blank form based on the Customer table.

Text Box

Chapter 10. Designing Forms

158

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

4 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 22, “MenuSuite Objects“.

5 In the Field Menu window, select the field (or fields) that you want to place on the form. The Field field contains the Name property, and the Caption field contains the Caption property. The Data Type field tells you the data type of the field.

Move the cursor into the design area and it changes into the Control Insertion cursor. You do not have to drag and drop; just select the field(s) and move the cursor over the form designer.

6 In the Form Designer, click once to activate the designer and click again to insert the text box(es). The text box is inserted below the point where you clicked. You can move it later if you want.

The text box that is created has the default size. You can click and drag to create a text box with a different size.

If you selected more than one field, the text boxes are inserted and aligned in a column below the mouse position. They are not linked together and can be moved apart later.

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, every property that is both a field property and a text box property has the value of the field property in the underlying table as its 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 both the naming and the properties are consistent.

If the data type of the field is anything but Boolean, a text box is created, but if the data type is Boolean, a check box is created.

10.3 Adding Controls

159

In document NavDoc (Page 165-171)