hook_<libraryPrefix>_displayInfoAreaIcon()

This function specifies which icon is displayed in an information area based on its state. The function then displays the icon for a symbol.

Synopsis

void hook_<libraryPrefix>_displayInfoAreaIcon(int InfoAreaNr, mapping dpesForInfoArea);

Parameters

Parameter Description
InfoAreaNr

Number of the information area.

"infoArea" + information area number must be specified in the symbol (e.g. through the use of the panel info_area.pnl as a reference).

dpesForInfoArea Data point element names that are called for the determination of the icon in an information area.

Return Value

-

Description

This function specifies which icon is displayed in an information area based on its state. It the displays this icon on the symbol.

Every information area has a predefined number (see Information areas). When the value of a data point element that is connected to this information area changes, the function is searched for a match of a data point element value and an icon ID-number in order to display a corresponding icon for this information area.

This function calls the HOOK-function library. Whether or not library-specific icon ID-numbers have been implemented for this information area is checked here. If this is the case, then the icon is used with the number specified in the library. If this is not the case (return value from hook_lib<LibName>_alterInfoAreaDisplay() = -1), the function hook_displayInfoAreaIcon specifies which icon is shown for an information area.

Furthermore, the library HOOK-function hook_<LibName>_getInfoAreaDPEs() is called. It specifies the data point elements that are visualized by the icon of an information area.

The function checks whether the information are is an area with implemented standard behavior. This means that the (dbInfoAreaUseDefault[InfoAreaNr] = TRUE.

This is the default behavior for the information areas 1 and 2. If the area is an area with the default behavior, the function does not search for an icon since an icon does not exist. If a standard behavior has not been specified for an information area, the function specifies the icon and it is shown in a faceplate.

Allocation of Information Areas and Icon ID Numbers

The information area is determined with the help of switch-case instructions. If a match is found, an ID number is assigned. If an icon is assigned to this ID number, the icon is displayed in the respective information area.

The default implementation of the individual information areas is described below. Information areas 1 and 2 have been implemented with a standard behavior. Therefore, the areas do not contain default icons or data point elements.

Information area 3 displays a note icon by default. Which data point elements have an impact on this InfoArea is determined. If no notes are available, the icon with ID number 1 is assigned to the information area. If a value was saved in the data point element (note), then the icon with ID number 2, which represents by default the icon note.png, is assigned to the information area.

Information area 4 displays an operation state icon by default. Whether or not the length of the mapping of data point elements and values is greater than 0 is determined. If this is the case, the library HOOK-function hook_<LibName>_getOperationModeElement() is called. The function determines the name of the data point node with operating states ("operationMode" by default). The values of the possible operating states are determined and the corresponding ID-numbers of icons are assigned to display the icon in the faceplate, see Information areas).

Information area 5 displays the invalid icon by default. If a data point is invalid, this icon is displayed in the faceplate with ID number 2.

No icon is displayed in the information area 6 (border of the click frame). The frame blinks/flashes in the color of the sum alert handling instead.

For more information on information areas, see Information areas.

You can find the function in the stdlib_hook_project.ctl under wincc_oa_path/Stdlib_3.19/scripts/libs/

void hook_displayInfoAreaIcon(int InfoAreaNr, mapping dpesForInfoArea)
{
  int iconId;
  string sIcon, sColor, sDpe;
  dyn_dyn_anytype dda;
  if (DebugInfos)   DebugTN("InfoArea #", InfoAreaNr);
  sIcon = stdlib_getInfoAreaIconFile(InfoAreaNr, dpesForInfoArea); // get the Icon for the infoArea#
  if (dbInfoAreaUseDefault[InfoAreaNr]==true)  // normally just display the icon or remove a displayed one
  {
    setValue("infoArea" + InfoAreaNr, "fill", (sIcon=="")?"[solid]":"[pattern,[fit,any," + sIcon + "]]");
  }
  else
  {
    switch (InfoAreaNr)  // if not default, maybe something else maybe should be done
    {
      case 3: setValue("infoArea" + InfoAreaNr, "fill", (sIcon=="")?"[solid]":"[pattern,[fit,any," + sIcon + "]]");
              break;
      case 4: setValue("infoArea" + InfoAreaNr, "fill", (sIcon=="")?"[solid]":"[pattern,[fit,any," + sIcon + "]]");
              break;
      case 5: setValue("infoArea" + InfoAreaNr, "fill", (sIcon=="")?"[solid]":"[pattern,[fit,any," + sIcon + "]]");
              break;
      case 6: if (mappinglen(dpesForInfoArea)>0)  // dont show icon for alerts, just set the foreCol to the act_state_color
      {
        sDpe = mappingGetKey(dpesForInfoArea, 1);
        sDpe = dpSubStr(sDpe, DPSUB_SYS_DP_EL);
        if ( dpSubStr(sDpe, DPSUB_SYS) == getSystemName() )
        dpQuery("SELECT ALERT '_alert_hdl.._alert_color', '_alert_hdl.._last' FROM '"+sDpe+"' WHERE '_alert_hdl.._last' == 1", dda);
        else
        dpQuery("SELECT ALERT '_alert_hdl.._alert_color', '_alert_hdl.._last' FROM '"+sDpe+"' REMOTE '" + dpSubStr(sDpe, DPSUB_SYS) + "' WHERE '_alert_hdl.._last' == 1", dda);
        if ( dynlen(dda) < 2 )
        setValue("infoArea" + InfoAreaNr, "foreCol", "_Transparent");
        else
        setValue("infoArea" + InfoAreaNr, "foreCol", dda[dynlen(dda)][3]);
      }
      break;
      default: break;
    }
  }
}