GLG Toolkit, C# Class Library  Version 4.6
Load, Setup and Display

This group contains methods used to load, set up and display a GLG drawing. More...

Detailed Description

This group contains methods used to load, set up and display a GLG drawing.

Functions

bool ConfigureWindow (int x, int y, int width, int height, GlgConfigureMask mask, GlgObject parent)
 Sets the size and/or position of a viewport's window. More...
 
void DialogInitialDraw (GlgObject parent)
 Displays a GLG drawing of the viewport as a floating dialog for the first time after it has been created or loaded. More...
 
void DialogSetupHierarchy (GlgObject parent)
 Provides an explicit request to set up the object hierarchy of a drawing displayed in a dialog window. More...
 
static void Init ()
 Initializes GLG Toolkit. More...
 
void InitialDraw ()
 Draws a GLG viewport object for the first time after it has been created or loaded. More...
 
static GlgObject LoadObject (Object medium, GlgMediumType medium_type)
 Loads an object from a stream using a default encoding. More...
 
static GlgObject LoadObject (Object medium, GlgMediumType medium_type, Encoding encoding)
 Loads an object from a stream using the specified encoding. More...
 
static GlgObject LoadObject (String filename, GlgMediumType medium_type)
 Loads an object from a GLG drawing file or a URL using a default encoding. More...
 
static GlgObject LoadObject (String filename, GlgMediumType medium_type, Encoding encoding)
 Loads an object from a file or a URL using the specified encoding. More...
 
static GlgObject LoadWidget (GlgObject glg_object)
 Finds a viewport named $Widget inside an object and returns it. More...
 
static GlgObject LoadWidget (String filename, GlgMediumType medium_type)
 Loads a viewport named $Widget from a file or a URL using a default encoding. More...
 
static GlgObject LoadWidget (String filename, GlgMediumType medium_type, Encoding encoding)
 Loads a viewport named $Widget from a file or a URL using the specified encoding. More...
 
bool Reset ()
 Reinitializes the viewport's drawing by resetting its drawing hierarchy, then setting it up again and rendering the drawing. More...
 
void ResetHierarchy ()
 Resets the object hierarchy of the object. More...
 
void SetupHierarchy ()
 Provides an explicit request to set up the object hierarchy of the object without rendering it. More...
 
static void Terminate ()
 Destroys GLG Toolkit's internal objects. More...
 
bool UpdateGlg ()
 Updates the drawing of a viewport or a light viewport with the latest resource values. More...
 
bool UpdateImmediately ()
 Advanced: Updates the drawing of a viewport or a light viewport with the latest resource values, immediately. More...
 

Function Documentation

◆ ConfigureWindow()

bool ConfigureWindow ( int  x,
int  y,
int  width,
int  height,
GlgConfigureMask  mask,
GlgObject  parent 
)

Sets the size and/or position of a viewport's window.

The method is new in the GLG release 4.5. The method should be invoked only for the viewport objects, not the light viewports.

Parameters
xSpecifies X coordinate of the window origin in device pixels.
ySpecifies Y coordinate of the window origin in device pixels.
widthSpecifies window width in device pixels.
heightSpecifies window height in device pixels.
mask

Specifies flags that can be combined with bitwise OR to control the action to perform, set size, set position or both:

  • POSITION_MASK requests to set window position using x and y parameters and ignore the position defined by the viewport's control points. For top-level viewports, the x and y parameters specify position in screen coordinates relative to the origin of the screen. For child viewports and embedded dialog viewports, position parameters specify position relative to the origin of their parent viewport's window.
  • SIZE_MASK requests to set window size using width and height parameters and ignore the width and height defined by the viewport's control points.
  • POSITION_AND_SIZE_MASK requests to set both the size and position, is equivalent to:
    @ SIZE_MASK
    Set size mask.
    @ POSITION_MASK
    Set position mask.
  • RESET_POSITION_MASK resets the position request to restore the position defined by the viewport's control points.
  • RESET_SIZE_MASK resets the size request to restore the width and height defined by the viewport's control points.

The set and reset flags are exclusive and can't be used together for the same size or position attribute.

parentSpecifies an optional parent viewport for dialog viewports displayed via the DialogSetupHierarchy or DialogInitialDraw methods, or null otherwise.
Returns
Success or failure status.

Once the viewport's size or position is set using ConfigureWindow, the viewport's control points are no longer used for controlling the viewport's size and/or position. If only the viewport's position is set and not its size, the size will be still controlled by the viewport's control points, and vice versa if only the size is set and not the position. The mask parameter of the method contains options to restore the use of the control points for determining the viewport's size or position after it was set with ConfigureWindow.

◆ DialogInitialDraw()

void DialogInitialDraw ( GlgObject  parent)

Displays a GLG drawing of the viewport as a floating dialog for the first time after it has been created or loaded.

The method should be invoked only for the viewport objects and not the light viewports.

Parameters
parentSpecifies the viewport of the main drawing the dialog will be a child of.

This method is similar to InitialDraw, with the only difference that the drawing will be displayed as a child dialog of the main drawing specified by the parent parameter.

ConfigureWindow may be used to set the dialog's size and position.

◆ DialogSetupHierarchy()

void DialogSetupHierarchy ( GlgObject  parent)

Provides an explicit request to set up the object hierarchy of a drawing displayed in a dialog window.

The method is invoked on a viewport containing the dialog's drawing.

Parameters
parentSpecifies the viewport of the main drawing the dialog will be a child of.

This method similar to SetupHierarchy, with the only difference that the drawing will be set up as a child dialog of the main drawing specified by the parent parameter.

This method needs to be invoked only on the initial draw of the dialog. After the dialog has been set up, a generic SetupHierarchy method may be used for all objects, including the dialog.

◆ Init()

static void Init ( )
static

Initializes GLG Toolkit.

This method is automatically invoked if the GLG library is deployed using GlgControl. However, it's always a good idea to explicitly call this method at the beginning of the application code.

◆ InitialDraw()

void InitialDraw ( )

Draws a GLG viewport object for the first time after it has been created or loaded.

The method displays a viewport's drawing and is part of the GLG Generic API.

The method creates a top level window and renders the viewport's drawing in it.

This method does not need to be explicitly called for the top level viewport of the GlgControl, since the control automatically invokes this method when it is displayed.

InitialDraw is equivalent to the following sequence:

viewport.SetupHierarchy();
viewport.UpdateGlg();

◆ LoadObject() [1/4]

static GlgObject LoadObject ( Object  medium,
GlgMediumType  medium_type 
)
static

Loads an object from a stream using a default encoding.

Parameters
mediumThe source to load the object from (Stream).
medium_typeSource type, must be STREAM.
Returns
Loaded object or null if loading fails.

◆ LoadObject() [2/4]

static GlgObject LoadObject ( Object  medium,
GlgMediumType  medium_type,
Encoding  encoding 
)
static

Loads an object from a stream using the specified encoding.

Parameters
mediumThe source to load the object from (Stream).
medium_typeSource type, must be STREAM.
encodingEncoding for string decoding.
Returns
Loaded object or null if loading fails.

◆ LoadObject() [3/4]

static GlgObject LoadObject ( String  filename,
GlgMediumType  medium_type 
)
static

Loads an object from a GLG drawing file or a URL using a default encoding.

Parameters
filenameSpecifies the name of the file or a URL to load the object from.
medium_typeFILE or URL constant.
Returns
The loaded object or null if loading failed.

This method loads an object from the specified file or URL and returns the object. If the file or the URL is not accessible or is not in the GLG save format, an error message is generated and null is returned.

◆ LoadObject() [4/4]

static GlgObject LoadObject ( String  filename,
GlgMediumType  medium_type,
Encoding  encoding 
)
static

Loads an object from a file or a URL using the specified encoding.

Parameters
filenameSpecifies the name of the file or the URL to load the object from.
medium_typeFILE or URL constant.
encodingEncoding for string decoding.
Returns
Loaded object or null if loading fails.

◆ LoadWidget() [1/3]

static GlgObject LoadWidget ( GlgObject  glg_object)
static

Finds a viewport named $Widget inside an object and returns it.

Parameters
glg_objectAn object containing the $Widget viewport.
Returns
The found $Widget viewport or null if the search fails.

◆ LoadWidget() [2/3]

static GlgObject LoadWidget ( String  filename,
GlgMediumType  medium_type 
)
static

Loads a viewport named $Widget from a file or a URL using a default encoding.

Parameters
filenameSpecifies the name of the file or the URL to load the widget from.
medium_typeFILE or URL constant.
Returns
Loaded viewport or null if loading fails.

This method loads a drawing from a file or a URL and searches the drawing for a viewport object named $Widget. If the viewport is found, it references and returns it, otherwise it produces an error message and returns null.

◆ LoadWidget() [3/3]

static GlgObject LoadWidget ( String  filename,
GlgMediumType  medium_type,
Encoding  encoding 
)
static

Loads a viewport named $Widget from a file or a URL using the specified encoding.

Parameters
filenameSpecifies the name of the file or the URL to load the widget from.
medium_typeFILE or URL constant.
encodingEncoding for string decoding.
Returns
Loaded viewport or null if loading fails.

This method loads a drawing from a file or a URL and searches the drawing for a viewport object named $Widget. If the viewport is found, it references and returns it, otherwise it produces an error message and returns null.

◆ Reset()

bool Reset ( )

Reinitializes the viewport's drawing by resetting its drawing hierarchy, then setting it up again and rendering the drawing.

Calling Reset restores all volatile resource changes to the values the resources had when the widget was first drawn. It also discards currently displayed chart data, unless the chart Persistent attribute is set to true.

The method should be invoked only for the top-level viewports, not the child viewports or the light viewports.

Returns
true if the drawing has been successfully reinitialized, otherwise false.

◆ ResetHierarchy()

void ResetHierarchy ( )

Resets the object hierarchy of the object.

Resets the object hierarchy of a top-level viewport. If a viewport containing a drawing was displayed using the InitialDraw or DialogInitialDraw, this method erases the drawing.

This method should not be called for the top-level viewports used in the GlgControl.

Warning: Do not confuse this method with the Reset method, which is used to redraw a displayed drawing and to regenerate the object hierarchy.

◆ SetupHierarchy()

void SetupHierarchy ( )

Provides an explicit request to set up the object hierarchy of the object without rendering it.

When invoked on a drawing which has been loaded but not yet displayed, the method sets up the drawing's object hierarchy to prepare the drawing for rendering. The drawing should contain either a top-level viewport object, or a group containing several top-level viewports.

After the initial draw (when the object hierarchy has already been set up), the method can be used to set up any type of object after its resources were changed. Unlike UpdateGlg,SetupHierarchy sets up the object without repainting it.

◆ Terminate()

static void Terminate ( )
static

Destroys GLG Toolkit's internal objects.

◆ UpdateGlg()

bool UpdateGlg ( )

Updates the drawing of a viewport or a light viewport with the latest resource values.

Returns
true if the drawing has been successfully updated, otherwise false.

If the object is a light viewport, an update of its parent viewport will be performed. All resource changes are held until the UpdateGlg method is called or until the viewport's window receives an expose event. (That is, it must be redrawn because another window that was obscuring a part of the viewport's window has been moved. This causes the viewport to redraw itself, using its new data.)

Note: Some drawing resources affect the object hierarchy of the drawing. For example, the Factor attribute of a series object controls the number of template instances that will be created by the series. If a number of instances is increased by setting the series' Factor, the new instances will be created and their resources can be accessed only after the UpdateGlgor SetupHierarchy method is invoked. If the series object is not persistent, any change (either increase or decrease) of its Factor attribute recreates its instances, and either the UpdateGlgor SetupHierarchy method should be called before accessing resources of the series' instances.

◆ UpdateImmediately()

bool UpdateImmediately ( )

Advanced: Updates the drawing of a viewport or a light viewport with the latest resource values, immediately.

Updates the drawing without deferring the actual painting until the next paint event. It is rarely necessary to call this method, as it is less efficient than the UpdateGlgmethod and does not guarantee a perfect redraw of children viewports. However, this method is useful if one needs to update the display while the current event is being dispatched.

Returns
true on success,