COMPONENTS (or C) keyword

Applies To

All specifications

Description

Returns the value of the named component

Syntax

COMPONENTS(compon entName) or C(c omponentName)

Remarks

In a Tree component, the keyword returns the first property in the current node.

In an event handler calling a form script, you can pass C(componentName) as one of the parameters, and your code will receive the value of the component for that parameter.

The COMPONENTS keyword has a special function in the Caption field of the Form Component Properties dialog box (General tab). Used as a caption specification for a component such as an Edit or ComboBox component, COMPONENTS links the component with another component, usually a Static component, that serves as the component's label.

For example, in an Edit component named CustomerNameEdit, the Caption "COMPONENTS(CustomerNameStatic)" specifies that the current value of the Static box named CustomerNameStatic is the label for the component. This link is important in maintaining accurate text in messages related to the component.

Often, and ideally, the Edit or ComboBox component inherits its caption from the IDO property to which it is bound. Using C(associatedComponentStatic) allows any changes to the IDO property's Label String ID to flow automatically to the associated Static component.

When used as a Caption specification, the COMPONENTS keyword either gets the value of the named component or passes a caption value to the named component. In this example,

  • If CustomerNameStatic has a Caption specification, the value of that specification serves as the label for CustomerNameEdit on the form and in user messages.
  • If CustomerNameStatic does not have a Caption specification -- that is, it has no value -- it inherits the caption specified in the CustomerNameEdit property class.
  • If CustomerNameStatic does not have a Caption specification and no caption is specified in the CustomerNameEdit property class, the caption is blank.
Rubriques liées