IResourceItems.Id

Fore Syntax

Id(Key: Integer): String;

Fore.NET Syntax

Id[Key: uinteger]: 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.

Fore 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.

Fore.NET Example

The requirements and result of the Fore.NET example execution match with those in the Fore example.

Imports Prognoz.Platform.Interop.ForeIO;

Public Shared Sub Main(Params: StartParams);
Var
    mb: IMetabase;
    Resource: IResourceObject;
    ResStrs: IResourceStrings;
    StrKey: uinteger;
Begin
    // Get current repository
    mb := Params.Metabase;
    // Get resources
    Resource := mb.ItemById["APP_RESOURCE"].Edit() As IResourceObject;
    // Get string elements for default language
    ResStrs := Resource.Strings;
    // Get resource string element key
    StrKey := ResStrs.FindById("Button1");
    // If element is found, change its identifier
    If StrKey <> uinteger.MaxValue Then
        ResStrs.Id[StrKey] := "BntCancel";
    End If;
    // Save changes
    (Resource As IMetabaseObject).Save();
End Sub;

See also:

IResourceItems