Destroy - cObject

Destroys the object that receives the message and any child objects of that object

Type: Procedure

Parameters: None

Syntax
Procedure Destroy 

Call: Send Destroy


Description

The Destroy message destroys the object that receives the message. It also destroys any child objects contained within the object. When an object is destroyed all resources used by the object are freed.

Handle hoObject
Send Destroy of hoObject


Procedure ProcessList
    Handle hoArray
    Integer i

    Get Create (RefClass(Array)) to hoArray
    For i from 0 to 100
        Set Value of hoArray i to "Test Data"
    Loop

    Send PrintData hoArray
    Send Destroy of hoArray
End_Procedure


The Destroy message can be used to destroy any object but is typically used to destroy dynamically created objects. Dynamic object creation is usually done using the Create message.


Note:You should always deactivate objects before destroying them. Active objects are objects that have received (directly or indirectly) the Activate message. You can test with Active_State if an object is active. You can deactivate an active object by sending Deactivate to the object.

See Also

Create | Dynamic Objects