|
GLG Toolkit, C# Class Library
Version 4.6
|
This group contains miscellaneous utility methods. More...
This group contains miscellaneous utility methods.
Functions | |
| static void | Bell () |
| Emits an audio beep. More... | |
| static String | ConcatResNames (String resource_name1, String resource_name2) |
| Creates a composite resource path from two components. More... | |
| static String | CreateIndexedName (String template_name, int resource_index) |
| Creates a string with a name of an enumerated resource. More... | |
| static bool | EnableTimerXforms (bool state) |
| ADVANCED: Enables or disables all timer transformations defined inside GLG drawings. More... | |
| static bool | GetModifierState (GlgModifierType modifier) |
| Returns the current state of a modifier. More... | |
| Object | GetNativeComponent (String resource_name, GlgComponentQueryType type) |
| ADVANCED: Returns a native component used to render the viewport. More... | |
| static String | GetStackTraceAsString () |
| Returns current stack trace as a string. More... | |
| static String | GetStackTraceAsString (Exception e) |
| Returns the stack trace of the specified exception as a string. More... | |
| static bool | IsDemo () |
| Queries the type of the GLG library. More... | |
| static String | Printf (String format, double value) |
| C-style printf method for formatting double values. More... | |
| static String | Printf (String format, int value) |
| C-style printf method for formatting integer values. More... | |
| static String | Printf (String format, String value) |
| C-style printf method for formatting strings. More... | |
| static double | Rand (double low, double high) |
| Returns a random number in the specified range. More... | |
| bool | SetCursorType (String resource_name, GlgCursorType cursor_type) |
| Sets cursor for the viewport's drawing or one of its child viewports. More... | |
| void | SetFocus (String resource_name) |
| Sets the keyboard focus to the object's viewport. More... | |
| static bool | Sleep (long millisec) |
| Sleeps for the specified number of milliseconds. More... | |
| static void | ThrowExceptionOnError (bool user_error, bool internal_error) |
| Controls displaying a stack trace on errors. More... | |
|
static |
Emits an audio beep.
|
static |
Creates a composite resource path from two components.
This method is provided to mimic C/C++ API in cases when the C/C++ GLG code is converted to C# .
| resource_name1 | Specifies the first resource path component. |
| resource_name2 | Specifies the second resource path component. |
This method creates and returns a resource path formed by concatenating the two components with the / character between them. The method checks if a trailing / separator is already present in the first string, and adds it only if the separator is not present.
Either argument may be null, in which case the returned string will precisely equal the input value of the other argument.
Examples
The following code:
produces the following output:
Multiple calls to ConcatResNames may be used to create composite paths from more than two components:
producing the following output:
|
static |
Creates a string with a name of an enumerated resource.
This method is provided to mimic C/C++ API in cases when the C/C++ GLG code is converted to C# .
| template_name | A character string containing the template name to be expanded. This name uses the % character to define the expansion position. |
| resource_index | Specifies the number to use for expanding the % character in the template name. |
This method creates and returns a resource name by replacing the first (leftmost) occurrence of the % expansion character within the template name with the number corresponding to the resource_index parameter. If the template name does not contain the expansion character, the number is added to the end of the name.
Examples
The following code:
produces the following output:
CreateIndexedName may be used repeatedly if a template name has more than one expansion character. For example, the following code:
produces the following output:
|
static |
ADVANCED: Enables or disables all timer transformations defined inside GLG drawings.
This method may be used to temporarily disable time transformation in some advanced usage scenarios, such as reparenting GlgControl components.
| state | The new enabled state. |
|
static |
Returns the current state of a modifier.
| modifier | Specifies the modifier to query, may be one of the following constants: |
| Object GetNativeComponent | ( | String | resource_name, |
| GlgComponentQueryType | type | ||
| ) |
ADVANCED: Returns a native component used to render the viewport.
The method provides an access to native components used to render the viewport, making it possible to set their native properties.
| resource_name | A resource path of a child viewport, or null to query the viewport the method is invoked on. The resource path is relative to the invoking object. |
| type | The type of a component to retrieve:
|
|
static |
Returns current stack trace as a string.
|
static |
Returns the stack trace of the specified exception as a string.
| e | An exception to generate the stack trace of. |
|
static |
Queries the type of the GLG library.
|
static |
C-style printf method for formatting double values.
| format | C-style format string. |
| value | Double value to be formatted. |
|
static |
C-style printf method for formatting integer values.
| format | C-style format string. |
| value | Integer value to be formatted. |
|
static |
C-style printf method for formatting strings.
| format | C-style format string. |
| value | String value to be formatted. |
|
static |
Returns a random number in the specified range.
| low | The low limit. |
| high | The high limit. |
| bool SetCursorType | ( | String | resource_name, |
| GlgCursorType | cursor_type | ||
| ) |
Sets cursor for the viewport's drawing or one of its child viewports.
| resource_name | A resource path of a child viewport, or null to set cursor for the viewport the method is invoked on. The resource path is relative to the invoking object. |
| cursor_type | One of the system cursor types to be used: |
The specified cursor will be used when the mouse moves inside the viewport the cursor is assigned to. The drawing's hierarchy must be set up in order to set cursor type.
| void SetFocus | ( | String | resource_name | ) |
Sets the keyboard focus to the object's viewport.
If the target object is a viewport, the focus is set to this viewport, otherwise the focus is set to the target object's parent viewport.
| resource_name | A resource path of a target child object, or null to use the object the method is invoked on. The resource path is relative to the invoking object. |
|
static |
Sleeps for the specified number of milliseconds.
| millisec | Requested sleep time. |
|
static |
Controls displaying a stack trace on errors.
| user_error | Set to true to display a stack trace on application errors, such as "Can't find resource". |
| internal_error | Set to true to display a stack trace on internal GLG errors. |