Connecting Resources to Form

Resources can be connected to a form:

Connecting Resources to Form in Development Environment

To connect resources to a form in the development environment, start the development environment and open the required form in it. In the object inspector set value of the Resources property:

In the Resources property specify identifier of the used resources:

After resources are connected to a form for all visual components in the object inspector, the ResourcesID additional attribute is added to string data type properties. This attribute maps values of resources' row elements with values of string data type properties for visual components. The attribute value is generated automatically and includes the name of the component containing the object, the object name and the property name separated by points.

NOTE. The ResourcesID attribute value of the Text property includes only the name of the component containing the object and the object name separated by a point.

New row elements with identifiers specified in the ResourcesID attribute are added for all languages in resources connected to the form.

When the value of the ResourcesID attribute is changed, the identifier of the corresponding element is changed in the connected resources.

When the value of a string data type property is changed, the corresponding element is changed for all languages of resources.

To map the row property of visual component with the other row element of resources, click the button in the ResourcesID attribute box. The Select Rows dialog box opens:

The dialog box shows all row elements of the resources connected to the form. Identifier and default language values are displayed for each resources' element. After selecting a new row element click the OK button.

Connecting Resources to Form Using Fore Language

To dynamically connect the resources to a form by means of the Fore language, use the following code:

Sub SetResource;
Var
    MB: IMetabase;
    Res: IResourceObject;
Begin
    MB := MetabaseClass.Active;
    Res := MB.ItemById("RESOURCE_1").Bind As IResourceObject;
    Self.Resources := Res;
End Sub SetResource;

After executing the procedure, resources with the Resource_1 identifier are used for the used form as a resources' source.

NOTE. To apply the code, replace the identifier used in the code with the actual resources' identifier.

See also:

Developing Multilingual Applications