More...
GlgObject is an abstract superclass of all GLG objects that provides GLG API functionality for all GLG objects.
Its methods are grouped by the API type (Standard, Intermediate and Extended).
The GlgObject link provides a flat list of all API methods.
Programming Notes: Using GLG API and GlgObject
The following describes details of using the JavaScript version of the GLG API:
- Global methods of the GlgObject class and the utility classes are marked with the static prefix and must be invoked on the GLG Toolkit handle obtained via a '
new GlgToolkit()' call at the application start-up.
For example:
GLG.LoadWidgetFromURL( "drawing.g", null, LoadCallback, null );
- Methods not marked with the static prefix are instance methods invoked on a GlgObject instance.
For example:
- The GlgObject instances are wrappers around the internal representation of the GLG objects. Because of that, the equality operator (==) cannot be used to compare if two instances of the GlgObject refer to the same actual GLG object. The Equals instance method or the ObjectsEqual global (static) method must be used instead.
For example:
...
let same_object = object1.Equals( object2 );
same_object = GLG.ObjectsEqual( object1, object2 );
- The GlgObject instances received as parameters of a listener method, such as the Input or Trace listener, are valid only inside the listener and the assignment operator (=) cannot be used to store them in global variables to be used outside of the listener (the only exception are GlgObject instances received as parameters of the load listeners).
The global GetReference method must be used to store GlgObject in a global variable in a way that allows it to be used outside of the listener.
For example:
...
let GlobalRef = GLG.GetReference( viewport );
- To minimize garbage collection, the ReleaseToCache method may be used to collect temporary objects, such as GlgPoint or GlgCube, after they have been used. ReleaseToCache may also be invoked on temporary GlgObject instances, in which case it will release to the cache the object's wrapper instance, without affecting the internal GLG object the wrapper refers to.
For example:
let point = object.GetGResource( "Point1" );
MyMethod( point );
GLG.ReleaseToCache( point );
- Follow this link for information on using predefined constants.
- Follow this link for information on type checking and debugging.