OriginObject::Destroy

Description

Destroy (delete) the OriginObject.

Syntax

BOOL Destroy( DWORD dwCntrl = OCD_DEL_LINKED_OBJS | OCD_DEL_PARENT_IF_LAST )

Parameters

dwCntrl
[input]various bits to control further the related actions to be taken on deleting the object. This is used for Layer only.
OCD_DEL_PARENT_IF_LAST : If the OriginObject is the last Layer in the Page then also destroy the page
OCD_DEL_LINKED_OBJS: also delete all the linked datasets if the OriginObject is a worksheet layer or matrix layer, since all the column and matrix objects are deleted.

Return

Returns TRUE on successful exit (the OriginObject was destroyed) and FALSE on failure.

Examples

EX1

// WARNING! Example deletes a worksheet if it is the active window
// Attach to the active layer in a project
// If it is a worksheet, destroy it
int OriginObject_Destroy_ex1()
{
    Worksheet wks = Project.ActiveLayer();
    if( wks.IsValid() )
    {
        printf("wks object is valid\n");
        wks.Destroy();
        if( wks.IsValid() )
            printf("Still valid (but shouldn't be)\n");
        else
            printf("No longer valid\n");
        return 0;
    }
    else
    {
        printf("There was a problem\n");
        return -1;
    }
}

Remark

Destroy (delete) the OriginObject.

See Also

Header to Include

origin.h