Tuesday, October 30, 2012

Cicode- CitectSCADA

/* This function will set the Window Title according to the tag name of the first variable  assigned on the page (ie ?INT 1?, ?Digital 1?)*/ 

FUNCTION
AssTitle(Int CharMask=0, String Prefix="", String Suffix="")

    WinTitle(Prefix + StrLeft(AssGetProperty(1, "TagName", 0),StrLength(AssGetProperty(1, "TagName", 0))-CharMask) + Suffix);
END


INT
FUNCTION
AssChainPopTrend(STRING sPage, STRING sTag1="", STRING sTag2="", STRING sTag3="",
     STRING sTag4="", STRING sTag5="", STRING sTag6="", STRING sTag7="", STRING sTag8="")

    AssChain(-2, WinNumber(), 0);
    RETURN TrendWin(sPage, 1, 1, 9, sTag1, sTag2, sTag3,sTag4,sTag5,sTag6,sTag7,sTag8);
END

FUNCTION
AssPopTrend(STRING sPage,STRING sTag1="",STRING sTag2="",STRING sTag3="",STRING sTag4="",STRING sTag5="",STRING sTag6="",STRING sTag7="",STRING sTag8="")
   
    INT x, y;
    REAL    ScaleX, ScaleY;

    DspGetMouse(x, y);

    ScaleX = StrToReal(PageInfo(16));
    ScaleY = StrToReal(PageInfo(17));
    x = x * ScaleX + StrToInt(PageInfo(14));
    y = y * ScaleY + StrToInt(PageInfo(15));

    IF x > WndInfo(0) - 150 THEN
        x = x - 150;
    ELSE
        x = x + 50;
    END
    IF y > WndInfo(1) - 150 THEN
        y = y - 150;
    ELSE
        y = y + 20;
    END

    x = x / ScaleX;
    y = y / ScaleY;

    AssVarTags(-2, 0, sTag1, sTag2, sTag3, sTag4, sTag5, sTag6, sTag7, sTag8);
    TrendWin(sPage, x, y, 9, sTag1, sTag2, sTag3,sTag4,sTag5,sTag6,sTag7,sTag8);
END

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.