Difference between revisions of "Obj.Create"

From OpenEUO
Jump to: navigation, search
(Created page with " local oref = Obj.Create (str) Create a gui object of the given type as specified by the string str. e.g. local form = Obj.Create ("TForm") instantiates a TForm object and as...")
 
Line 1: Line 1:
 
  local oref = Obj.Create (str)
 
  local oref = Obj.Create (str)
  
Create a gui object of the given type as specified by the string str. e.g.
+
Create a gui object of the given class as specified by the string str. e.g.
  
 
  local form = Obj.Create ("TForm")
 
  local form = Obj.Create ("TForm")
  
instantiates a TForm object and assigns form a pointer to this object.  Access members, methods, and event handlers of an object using dot notation:
+
instantiates a TForm object and assigns form a pointer to this object.  Access members, methods, and event handlers of an object by using dot notation:
  
 
   form.Caption = "Test"
 
   form.Caption = "Test"
 
   form.OnClose = function (pSender) Obj.Exit() return
 
   form.OnClose = function (pSender) Obj.Exit() return
 
   form.Show()
 
   form.Show()
 +
  Obj.Loop()
 +
  Obj.Free(form)
  
An object's set event handlers won't be active until the script enters an Obj.Loop call.  See objects.txt in the openeuo distribution for available objects, their inheritance hierarchies, and associated members.
+
An object's set event handlers must be defined before, and won't be active until, the script reaches a subsequent Obj.Loop call.  Do not free an object with set event handlers while an Obj.Loop call is active.   
 +
 
 +
See objects.txt in the openeuo distribution for available objects, their inheritance hierarchies, and associated members.  The object system utilizes Delphi's visual component library; directly consult VCL documentation for a thorough object reference.
  
 
[[Obj.Loop]]
 
[[Obj.Loop]]
  
 
[[Obj.Free]]
 
[[Obj.Free]]

Revision as of 09:41, 9 October 2010

local oref = Obj.Create (str)

Create a gui object of the given class as specified by the string str. e.g.

local form = Obj.Create ("TForm")

instantiates a TForm object and assigns form a pointer to this object. Access members, methods, and event handlers of an object by using dot notation:

 form.Caption = "Test"
 form.OnClose = function (pSender) Obj.Exit() return
 form.Show()
 Obj.Loop()
 Obj.Free(form)

An object's set event handlers must be defined before, and won't be active until, the script reaches a subsequent Obj.Loop call. Do not free an object with set event handlers while an Obj.Loop call is active.

See objects.txt in the openeuo distribution for available objects, their inheritance hierarchies, and associated members. The object system utilizes Delphi's visual component library; directly consult VCL documentation for a thorough object reference.

Obj.Loop

Obj.Free