Applies To:
  • CitectSCADA

Summary:
 How do I display my variable tag 'Comment' as the tags tooltip at runtime without manually entering each one?

Solution:
 Calling the following Cicode on startup will enable this functionality so that whenever the mouse hovers over a digital tag the tag comment will be displayed in the tooltip.

///////////////////////////////////////////////////////////////////////
// Function: ToolTip - variable tag comments (digitals only)
// Author: Lee Duguid - Citect Support
// Date: 3/02/09
// DESCRIPTION: Function to get the variable tag comment for digital tags only and display it as the tooltip.

FUNCTION ToolTip()

INT ix
INT iy
INT iAN
STRING sTagType
STRING hInfo
STRING sTagname

    WHILE 1 DO
        DspGetMouse(ix,iy); // find the location of the mouse and set the x and y coordinated into ix and iy.
        iAN = DspGetNearestAn(ix,iy); // store the AN number into a cicode variable
        hInfo = DspInfoNew(iAN); // Creates an object information block
        sTagname = DspInfo(hInfo,3,0); // reads the variable tag name of the current AN
        sTagType = TagInfo(sTagname,10); // is DIGITAL?
        IF sTagType = "0" THEN
            DspSetTip(iAN, TagInfo(sTagname, 16)); // sets the new tool tip
        ELSE  
        END
        DspInfoDestroy(hInfo); // Destroy's the object information block
        SleepMS(40);  // So not to max out CPU
    END
END


This function can easily be adapted to do the same for all tags.

Keywords:
 tool tip, comment, tag

Attachments