Applies To:
  • CitectSCADA 3.xx, 4.xx, 5.00

Summary:
I have a project with some general pages and popups as well as trend pages and popups. Sometimes after I have been on a trend page/popup for a while Citect will crash when I go to use the trend cursor. Is there a fix for this problem? 

Solution:
This problem is caused in the problem outlined in Q2300. Trend pages/popups use the Cicode function KeySetSeq to set up key sequences for the trend cursor. The problem with this function is that when any POPUP is opened and closed, all the key sequences set by KeySetSeq are deleted when only the key sequences for the popup being closed should be deleted. Due to the buffering of this memory the problem will not be immediately apparent. However after 10 minutes or so use of the trend cursor may cause Citect to crash. A simple workaournd to this problem is to make sure that the key sequences are continually set. This will not consume resources as the function only makes sure that the sequences are set. For the trend pages this can be done by making the following modification to Trend.ci found in the Include project. Move the two calls to KeySetSeq above the line

IF StrToInt(PageInfo(7)) = 0 THEN

The function should then look like...

Version 3.40/4.20

INT
FUNCTION
TrendRun()

   KeySetSeq("[" + IntToStr(KEY_LBUTTON) + "]", 0, _EventCreateTrendMouseCursor);
   KeySetSeq("[" + IntToStr(KEY_LBUTTON_UP) + "]", 0, _EventKillTrendMouseCursor);

   IF StrToInt(PageInfo(7)) = 0 THEN
      nTrendCursorMode = 0;
      TrendZoomInit();
      PageSetInt(STATS_TASK_HND, BAD_HANDLE);
   END
   return 0;
END

Version 5.00

INT
FUNCTION
TrendRun(INT PageType = TRN_PAGE_NORMAL)

   KeySetSeq("[" + IntToStr(KEY_LBUTTON_DN) + "]", 0, _EventCreateTrendMouseCursor);
   KeySetSeq("[" + IntToStr(KEY_LBUTTON_UP) + "]", 0, _EventKillTrendMouseCursor);

   IF StrToInt(PageInfo(7)) = 0 THEN
      nTrendCursorMode = 0;
      TrendZoomInit();
      PageSetInt(STATS_TASK_HND, BAD_HANDLE);
      TrnPageTypeSet(PageType);
   END
   return 0;
END

Moving these lines makes sure that the key sequences are continually set as TrendRun is continually called from trend pages/popups. 

Note:

This workaround may cause increased CPU/Memory usage on the pages where implemented. Changing to another display drops the CPU/memory usage back to their original levels. These functions are used typically for trend pages / popups in version 3 and prior. If the increased CPU/memory usage is a problem then it is advised to convert these pages to the Version 5 equivalents that do not have this problem.

 

Keywords:
 

Attachments