Difference between revisions of "NEWOBJECT()"

From Recital Documentation Wiki
Jump to: navigation, search
(Class)
 
(4 intermediate revisions by one user not shown)
Line 1: Line 1:
 
 
 
==Purpose==
 
==Purpose==
Function to create a new class or object from a .vcx visual class library or program.
+
Function to create a new object
  
  
 
==Syntax==
 
==Syntax==
NEWOBJECT(<expC1> [,<expC2> [,<expC3> [,<exp1>,<exp2>, ...]]])
+
NEWOBJECT(<expC1> [, <exp1>, <exp2>, ...]]])
  
  
 
==See Also==
 
==See Also==
[[ACLASS()]], [[ADDPROPERTY()]], [[AMEMBERS()]], [[CLASS]], [[CLONE()]], [[COMPOBJ()]], [[CREATEOBJECT()]], [[DEFINE CLASS]], [[DODEFAULT()]], [[METHOD]], [[REMOVEPROPERTY()]], [[SET CLASSLIBRARY]], [[TOSTRING()]], [[WITH]]
+
[[ACLASS()]], [[ADDPROPERTY()]], [[AMEMBERS()]], [[CLASS]], [[CLASS - Methods]], [[CLASS - Parameters]], [[CLASS - Properties]], [[CLASS - Scoping]], [[COMPOBJ()]], [[CREATEOBJECT()]], [[DEFINE CLASS]], [[DISPLAY CLASSES]], [[DODEFAULT()]], [[FOREACH]], [[LIST CLASSES]], [[LOADOBJECT()]], [[METHOD]], [[OBJECT()]], [[PRINT_HTML()]], [[PRINT_JSON()]], [[PRINT_R()]], [[PRINT_XML()]], [[REMOVEPROPERTY()]], [[REQUIRE_ONCE()]], [[SAVEOBJECT()]], [[SQL SELECT]], [[WITH]]
  
  
 
==Description==
 
==Description==
The NEWOBJECT() function is used to create a new class or object from a .vcx visual class library or program.  The class or object on which the new  
+
The NEWOBJECT() function is used to create a new object.  The <expC1> is
 +
the class on which the new object is based.  Optionally, parameters can be passed to the object's ''init'' [[CLASS - Methods|method]] in <exp1>, <exp2>, ... .
  
 
+
The NEWOBJECT() function returns a reference to the newly created object.
{| class="wikitable"
+
!Parameters||Required||Description
+
|-
+
|<expC1>||Yes||The class or object on which the new class or object is based.
+
|-
+
|<expC2>||No||The module that contains <expC1>.
+
|-
+
|<expC3>||No||The application (.exe, or .app) that contains <expC2>.
+
|-
+
|<exp1>,<exp2>,...||No||The parameters to be passed to the class or object's Init event procedure.
+
|-
+
|}
+
 
+
 
+
The NEWOBJECT() function returns a reference to the newly created class or object.
+
  
  
 
==Example==
 
==Example==
 
<code lang="recital">
 
<code lang="recital">
mySpreadSheet = newobject("Excel.Sheet")
+
class opentable
 +
        property cAlias
 +
        property nRecnum
 +
        procedure init(pAlias)
 +
                use &pAlias
 +
                this.cAlias = pAlias
 +
        endproc
 +
        procedure nRecnum_access
 +
                this.nRecnum = recno()
 +
        endproc
 +
endclass
 +
 
 +
oCompany = newobject("opentable","example")
 +
? oCompany.nRecnum
 +
? oCompany.cAlias
 
</code>
 
</code>
  
  
 
==Products==
 
==Products==
Recital Database Server, Recital Mirage Server, Recital Terminal Developer
+
Recital, Recital Server
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[Category:Functions]]
 
[[Category:Functions]]
 
[[Category:Objects]]
 
[[Category:Objects]]
 
[[Category:Objects Functions]]
 
[[Category:Objects Functions]]

Latest revision as of 15:07, 14 December 2009

Purpose

Function to create a new object


Syntax

NEWOBJECT(<expC1> [, <exp1>, <exp2>, ...]]])


See Also

ACLASS(), ADDPROPERTY(), AMEMBERS(), CLASS, CLASS - Methods, CLASS - Parameters, CLASS - Properties, CLASS - Scoping, COMPOBJ(), CREATEOBJECT(), DEFINE CLASS, DISPLAY CLASSES, DODEFAULT(), FOREACH, LIST CLASSES, LOADOBJECT(), METHOD, OBJECT(), PRINT_HTML(), PRINT_JSON(), PRINT_R(), PRINT_XML(), REMOVEPROPERTY(), REQUIRE_ONCE(), SAVEOBJECT(), SQL SELECT, WITH


Description

The NEWOBJECT() function is used to create a new object. The <expC1> is the class on which the new object is based. Optionally, parameters can be passed to the object's init method in <exp1>, <exp2>, ... .

The NEWOBJECT() function returns a reference to the newly created object.


Example

class opentable
        property cAlias
        property nRecnum
        procedure init(pAlias)
                use &pAlias
                this.cAlias = pAlias
        endproc
        procedure nRecnum_access
                this.nRecnum = recno()
        endproc
endclass
 
oCompany = newobject("opentable","example")
? oCompany.nRecnum
? oCompany.cAlias


Products

Recital, Recital Server