GLG Toolkit, JavaScript Library  Version 4.6

Detailed Description

Functions

GlgObject CreateAlarmList ()
 Creates and returns a list of alarms defined in the object. More...
 
static GlgAlarmHandler SetAlarmHandler (GlgAlarmHandler alarm_handler)
 Installs a global alarm handler that will be invoked to process alarms. More...
 

Function Documentation

◆ CreateAlarmList()

GlgObject CreateAlarmList ( )

Creates and returns a list of alarms defined in the object.

Returns
A group containing all alarm objects, or null if no alarm objects were found.

Each element of the returned group is a data object that has an alarm attached. The GetElement and GetSize methods of the Intermediate API may be used within the Standard API to handle the returned group object.

If the object is not a viewport, the returned alarm list will include only alarms contained inside the object. For a viewport, the alarm list will contain all alarms defined in the viewport's drawing.

Example

The following code prints information about all alarms defined in the drawing:

let alarm_list = viewport.CreateAlarmList();
if( alarm_list != null )
{
let size = alarm_list.GetSize();
for( let i=0; i<size; ++i )
{
// The data object the alarm is attached to.
let data_object = alarm_list.GetElement( i );
// AlarmLabel may be unnamed, extract it as the XformAttr1 resource of the alarm object.
let alarm_label = data_object.GetSResource( "Alarm/XformAttr1" );
console.log( "AlarmLabel: " + alarm_label );
}
}

◆ SetAlarmHandler()

static GlgAlarmHandler SetAlarmHandler ( GlgAlarmHandler  alarm_handler)
static

Installs a global alarm handler that will be invoked to process alarms.

Alarms are generated by the Alarm objects attached to objects in the drawing and activated when the controlled values go outside the ranges specified in the Alarm objects.

Parameters
alarm_handlerAn alarm handler that will be invoked to process alarm messages generated by the application's drawings. Use CreateGlgAlarmHandler to create an alarm handler.
Returns
The previously installed alarm handler, or null.

See GlgAlarmHandler for more information.