Skip to content

TStringTableResource

String table resource type

Declaration

Source position: stringtableresource.pp line 46

type

  TStringTableResource = class(TAbstractResource)
  protected
    function GetType : TResourceDesc;
    function GetName : TResourceDesc;
    function ChangeDescTypeAllowed : Boolean;
    function ChangeDescValueAllowed : Boolean;
    procedure NotifyResourcesLoaded;
  public
    constructor Create;
    constructor Create(aType: TResourceDesc; aName: TResourceDesc);
    destructor Destroy;
    procedure UpdateRawData;
    property FirstID: Word; {rw}
    property LastID: Word; {r}
    property Count: Integer; {r}
    property Strings[id : Word]: string; {rw}
  end;

Description

This class represents a resource of type RT_STRING.

A string table is a resource containing strings, identified by an integer id in the range 0-65535. A string table contains exactly 16 strings, and its name is an ID in the range 1-4096, determined by the highest 12 bits of the strings ID it contains, plus one. That is, a string table with 1 as name holds strings with IDs from 0 to 15, string table 2 contains strings with IDs from 16 to 31 and so on. There is no difference between an empty string and a non-existant string.

For these reasons, it is not possible to set the name of a string table: it is autogenerated from the value of FirstID property. Moreover, Count property is always 16.

Strings property is provided to access and modify individual strings.

Remark:

This class doesn't allow its type to be changed to anything else than RT_BITMAP. Its name can't be changed too. Attempts to do so result in a EResourceDescChangeNotAllowedException.

Properties

Member Visibility Description
Count read only public The number of strings contained in the string table
FirstID public The ID of first the string contained in the string table
LastID read only public The ID of the last string contained in the string table
Strings public Indexed array of strings in the string table
See all Properties

Methods

Member Visibility Description
ChangeDescTypeAllowed protected
ChangeDescValueAllowed protected
Create public Creates a new string table resource
Destroy public
GetName protected
GetType protected
NotifyResourcesLoaded protected
UpdateRawData public
See all Methods