Difference between revisions of "CreateNewObject"

m (CreateNewObject(class, inModule, title, identifier, original))
m
 
Line 2: Line 2:
  
 
== CreateNewObject(class, inModule'', title, identifier, original'') ==
 
== CreateNewObject(class, inModule'', title, identifier, original'') ==
Create a new Analytica object of specified class, in specified module, and return a [[handle]] to it.   
+
 
 +
Create a new Analytica object with the specified class, in specified module, and return a [[handle]] to it.   
 +
 
 +
Key phrases: Make Object, New Object, Create Object, Make variable, New variable, Create variable
  
 
'''Parameters''':
 
'''Parameters''':
*«class»: the type of object, such as Variable, Chance, Index, Module, FormNode, etc.  
+
*«class»: the [[Classs]] or type of the new object, such as Variable, Chance, Index, Module, FormNode, etc.  
 
*«inModule»: the parent module to contain this object. It tries to position the node in the first available empty space in the diagram for this  module.
 
*«inModule»: the parent module to contain this object. It tries to position the node in the first available empty space in the diagram for this  module.
 
*«title»:  optional text for the Title attribute of the new object.
 
*«title»:  optional text for the Title attribute of the new object.
Line 14: Line 17:
  
 
== Usage ==
 
== Usage ==
This function is rarely used in models. It is used in advanced situations that implement [[meta-inference]] algorithms, such as algorithms that alter a model and its structure, or which automatically construct a sub-model for a specialized computation, or create "diagrams as drawings" to depict information.
+
Normally, you, as a modeler, create new objects using the Object menu.
 +
This function lets you write functions or buttons to automate the copying or creation of new objects, or an entire module, or create "diagrams as drawings" to depict information.
  
 
==History==
 
==History==

Latest revision as of 22:12, 28 September 2019


CreateNewObject(class, inModule, title, identifier, original)

Create a new Analytica object with the specified class, in specified module, and return a handle to it.

Key phrases: Make Object, New Object, Create Object, Make variable, New variable, Create variable

Parameters:

  • «class»: the Classs or type of the new object, such as Variable, Chance, Index, Module, FormNode, etc.
  • «inModule»: the parent module to contain this object. It tries to position the node in the first available empty space in the diagram for this module.
  • «title»: optional text for the Title attribute of the new object.
  • «identifier»: the desired identifier. If that identifier is already in use, it adds digits to the end to make a unique identifier. If not specified, it uses the «title» or «class» to generate an identifier.
  • «original»: if the object is an Alias or FormNode (User input or output), this is the original object to which it refers.

The creation of a new object is a side-effect -- i.e. it makes a permanent change to the model -- so you can only use CreateNewObject in a button's OnClick attribute (or the Typescript Window) or a Function called from OnClick. You cannot use it in the definition of a Variable.

Usage

Normally, you, as a modeler, create new objects using the Object menu. This function lets you write functions or buttons to automate the copying or creation of new objects, or an entire module, or create "diagrams as drawings" to depict information.

History

Introduced in Analytica 5.0.

See Also

Comments


You are not allowed to post comments.