Delete extern variable from memory.

Call:

var_extern_delete( string sVarName);


Here: 

sVarName - variable name, that we need to delete from memory.


Example.

Make it so that when the modeless dialog box is closed, the table object is deleted from memory and the variable is deleted.


int main()
{
#pragma region Create No Modal Dialog Panel
   object("create","ts_dialog",iDialogDescr);
   ts_dialog(iDialogDescr, "init_dialog","palette",0,0,450,400);
   ts_dialog(iDialogDescr, "set_as_main_panel");
   ts_dialog(iDialogDescr, "eventreaction", "Event_PanelCloseRequested"); // set event reaction
   ts_dialog(iDialogDescr, "SetTitle","Выгрузка BOQ и BOM");

   ...

#pragma endregion  

   ts_dialog(iDialogDescr, "invoke", bres);
 }

// Event reaction procedure
int Event_PanelCloseRequested(int iDescr, string sDescr)
{
    int toret = 0;

    int iTableReestrEdinichnyhRascenok; // reester of BOQ positions
    int ires = 0;
    ires = var_extern_get("iTableReestrEdinichnyhRascenok", iTableReestrEdinichnyhRascenok, 0);
    if (ires >= 0)
    {
        object("delete", iTableReestrEdinichnyhRascenok);
        var_extern_delete("iTableReestrEdinichnyhRascenok");
    }
    return toret;
}

// Create table if they not created befor
int CreateTableIfNeeded()
{
   int ires = 0;
   ires = var_extern_get("iTableReestrEdinichnyhRascenok", iTableReestrEdinichnyhRascenok, 0);
   if (ires != 0)
   {
      // 
      object("create", "ts_table", iTableReestrEdinichnyhRascenok);
      object("KeepInMemory", iTableReestrEdinichnyhRascenok);
      ...
   }
   else
   {
      ts_table(iTableReestrEdinichnyhRascenok, "reset_cpp_to_current");
   }
   return 0;
}