Sign in Join
FPDoc Onlineexperiment

TResources.AddAutoID function

Member of TResourcespublicIn unit resource

Adds a resource and gives it a new autogenerated name

Declaration

pascal
function AddAutoID(aResource: TAbstractResource): TResID

Arguments

aResource

The resource to add

Function result

The autogenerated ID of the added resource

Description

This method tries to find a spare ID to use as a name for the given resource, assigns it to the resource, and adds it.

This method is useful when the name of the resource is not important. E.g. a group resource doesn't care about the names of its sub-resources, so it could use this method to ensure that its sub-resources don't clash with names of other sub-resources of the same type.

Errors

If there are no more free IDs for the resource type of the given resource (that is, when the number of resources of the same type of aResource with an ID name is equal to 65536) an ENoMoreFreeIDsException exception is raised.

See also

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.