IResourceItems.Id

Syntax

Id(Key: Integer): String;

Parameters

Key. Object key.

Description

The Id property determines an object identifier with the specified key.

Comments

To set object key, use the IResourceItems.Key property.

Example

Executing the example requires that the repository contains resources with the APP_RESOURCE identifier that include a string element with the Button1 identifier. These resources contain default language as Russian and translation language as English.

Add links to the IO, Metabase system assemblies.

Sub UserProc;
Var
    mb: IMetabase;
    Resource: IResourceObject;
    ResStrs: IResourceStrings;
    StrKey: Integer;
Begin
    
// Get current repository
    mb := MetabaseClass.Active;
    
// Get resources
    Resource := mb.ItemById("APP_RESOURCE").Edit As IResourceObject;
    
// Get string elements for default language
    ResStrs := Resource.Strings;
    
// Get string resource element key
    StrKey := ResStrs.FindById("Button1");
    
// If element is found, change its identifier
    If StrKey <> -1 Then
        ResStrs.Id(StrKey) := 
"BntCancel";
    
End If;
    
// Save changes
    (Resource As IMetabaseObject).Save;
End Sub UserProc;

After executing the example the Button1 string element identifier is changed to BntCancel.

See also:

IResourceItems