Applies To:
  • CitectSCADA

The alarm templates in Citect allow you to scroll up and down one page at a time using the AlarmDspNext() and AlarmDspPrev() Cicode functions. How do you scroll one line at a time?

Use the AlarmSetInfo() Cicode function to set the offset of the top of the page. Increase the offset by 1 to scroll down 1 line, decrease it to scroll up. Set the offset to 0 to return to the top. The AlarmDspNext / Prev functions basically just increment / decrement the offset by the number of alarms per page to scroll one page at a time. You can add the following Cicode function to a Cicode file in your project to simplify the code to enter on the scroll buttons you create.
// Scroll the alarm list at the specified AN up or down the 
// specified number of lines
// hAN Alarm list starting animation number
// nLines Number of lines to scroll (positive or negative)
// -1 to scroll up
// 0 to return to the top
// 1 to scroll down
AlarmScrollLine(INT hAN, INT nLines)
INT cAlmOffsetLines = 1;
INT nOffset = 0;
 IF nLines <> 0 THEN
nOffset = AlarmGetInfo(hAN, cAlmOffsetLines) + nLines;

IF nOffset < 0 THEN
nOffset = 0;

AlarmSetInfo(hAN, cAlmOffsetLines, nOffset);
For example, if the alarm list starts at AN21, and you have a Scroll Down button you would set its Up Command to: AlarmScrollLine(21, -1)

To find the AN of the alarm list, open the Alarm page in the Graphics Builder. Hold the Ctrl key while double-clicking the Cicode object at the top of the alarm list. The AN will be listed on the Access (General) tab.