Id(Key: Integer): String;
Key. Object key.
The Id property determines an object identifier with the specified key.
To set object key, use the IResourceItems.Key property.
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: