2.13 :destroy()

With this method any objects or models of a dialog can be deleted. All children of the object are also deleted.

Definition

boolean :destroy
(
  { boolean DoIt := false input }
)

Parameters

boolean DoIt := false input

This optional parameter (default value false) controls how this object should be deleted. If true is specified here, the object is deleted and all rule parts that use this object are modified so that the respective statements are removed.

When the object to be deleted is a Model and the parameter is false, the Model is only deleted if it is not used by any other object (default). If true is specified in this case, then the Model is deleted and the objects that use this Model will refer to the next higher Model or the Default again.

Return value

true
Object could be deleted.
false
Object could not be deleted.

Note

:destroy() invokes the :clean() method of the object.

Example

dialog Example

model window MWnDetail
{
  !! detail view of data sets
  .title "Detail view of data";
  rule void GetData()
  {
    !! fetching the data
    !! make window visible
    this.visible ::= true;
  }
  child pushbutton PbExit
  {
    .text "&Exit";
    on select
    {
      !! destroys the window instance
      this.window:destroy();
    }
  }
}

window WnMain
{
  .title "Data overview";
  child tablefield TfData
  {
    !! contains a data overview
    on dbselect
    {
      variable object NewObj := null;
      
      !! create visible
      !! NewObj ::= MWnDetail:create(this.dialog);
      !! create invisible
      NewObj ::= MWnDetail:create(this.dialog, true);
      NewObj:GetData();
    }
  }
}

See also

Built-in function destroy() in manual “Rule Language”

C function DM_Destroy in manual “C Interface - Functions”

COBOL function DMcob_Destroy in manual “COBOL Interface”