Contains a string table resource type

This unit contains , a TAbstractResource descendant specialized in handling resource of type RT_STRING.

Adding this unit to a program's uses clause registers class for type RT_STRING with TResourceFactory.

Base class for string table resource-related exceptions The name of the resource isn't allowed

This exception is raised by constructor if the name of the resource isn't of type dtID and/or its name is not in the range 1-4096.

The ID of the string is out of range

This exception is raised when the id specified to access a string of property is not in the range - .

String table resource type

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.

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.
Creates a new string table resource

Please note that aType parameter is not used, since this class always uses RT_STRING as type.

aName must be a TResourceDesc of type dtID and its value must be in the range 1-4096, otherwise an exception is raised.

If aName is not of type dtID and/or its value isn't in the range 1-4096, an exception is raised.

Ignored. Can be nil. The name of the resource. Must be of type dtID and in the range 1-4096 The ID of first the string contained in the string table

This property holds the value of the ID of the first string of the table. It is a multiple of 16.

The name of the resource is determined by this property, so changing FirstID also changes the resource name.

If an attempt of setting this property to an integer that isn't a multiple of 16 is made, the value is automatically corrected to the closest multiple of 16 less than the value specified (e.g. setting it to 36 sets it to 32).
The ID of the last string contained in the string table

The value of this property is always FirstID+15.

The number of strings contained in the string table

Since a string table resource always contains exactly 16 strings, this property is always 16

Indexed array of strings in the string table

This property can be used to access all strings in the object.

Strings are accessed by their ID: valid elements range from FirstID to LastID. If the index specified isn't in this range, an exception is raised. If you need to access RawData after you modified strings, be sure to call UpdateRawData first. This isn't needed however when resource is written to a stream, since TResources takes care of it.
The ID of the string to be accessed