Language Reference Guide : System Classes : SpriteDescriptor Class : ApplySpriteMap Method
 
Share this page          
ApplySpriteMap Method
The ApplySpriteMap method displays the sprites defined by an array of populated SpriteDescriptor objects on the field background. Each sprite is applied in the array order, so that later sprites may overlap earlier ones.
ApplySpriteMap invokes the UpdBackground method on the specified field, applying the descriptors (converted to a spritemap string combining the propertystrings of the descriptors), according to the action specified in the call.
This method has the following syntax:
integer = SpriteDescriptor.ApplySpriteMap(targetfield = ActiveField
          [, descriptors = array of SpriteDescriptor][, operation = varchar(32)])
This method has the following parameters:
targetfield
(Required) Specifies the field to whose background the sprites are applied.
descriptors
Specifies the set of sprite descriptors from which the spritemap is drawn. If none is provided, the host SpriteDescriptor object itself is used.
operation
Specifies the way in which the sprites are applied. Valid modes are:
'apply'
The field background is overlaid by the sprites defined in the spritemap. Previous sprites disappear.
'assign'
The spritemap is assigned to the field (replacing the previous spritemap), but without changing the field background. The next refresh of the field will apply the spritemap and change the display.
'add'
The single sprite defined in the spritemap is applied to the field background. Previous sprites are preserved.
'remove'
The sprite whose PropertyString or SpriteIndex matches the single sprite defined in the spritemap disappears from the field's background. Other sprites are preserved.
'replace'
The sprite whose PropertyString or SpriteIndex matches the second of two sprites defined in the spritemap disappears from the field's background, and the first sprite from the spritemap is applied to the field background. Other existing sprites are preserved.
'query'
The descriptors parameter is populated with the sprite descriptors defining the current field background. Any descriptors provided with the parameter are ignored.
Default: 'apply'
The method returns ER_OK if the descriptors were applied successfully, or ER_FAIL if the call failed.