Applies To:
  • CitectSCADA 6.00
  • CitectHMI 6.00

Summary:
One of the new version 6 libraries is called xp_controls, which resides in the Include project. If you try to use genies from this library in your own project, you will get a compile error: "FUNCTION expected" with context "Line[1]:{DspGetMouseDown}()". This is caused by three functions, DspGetMouseDown, DspIsMouseDown and DspRegisterMouseDown being defined in a cicode file "ProcessLine_Simulation.ci" which resides in the Example project.  

Solution:
To solve the compile errors and use the genies, copy the following code into a new cicode file (e.g. MouseDownFunctions.ci) in your project:

// MODULE VARIABLES

// Mouse Button Variables
// ----------------------
// Stores the details of items that have been clicked
INT fhHandlerChain = -1;
INT fnButtonDown = 0;

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//         FUNCTION NAME
//                             MouseDown Functions
//
//         REV DATE         WHO         DESCRIPTION
// 0
//
//         GENERAL DESCRIPTION
//
// Series of functions to react to mouse down event, determine if the mouse is down
// and return ask if the mouse down is over a particular aN number.
//
//
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
FUNCTION DspRegisterMouseDown()
    fhHandlerChain = GetEvent(1);
    OnEvent(1,DspIsMouseDown);
END

INT
FUNCTION DspIsMouseDown()

    INT nKey;
    nKey = KeyPeek(0);

    IF nKey = KEY_LBUTTON_DN THEN
        fnButtonDown = KeyGetCursor();
    ELSE
        fnButtonDown = 0;
    END

    INT nChainReturn;
    IF fhHandlerChain <> -1 THEN
        nChainReturn = ChainEvent(fhHandlerChain);
    END
    RETURN nChainReturn;
END
INT
FUNCTION DspGetMouseDown(INT hAN=0)
    IF hAN = 0 THEN
        hAN = DspGetAnCur();
    END
    RETURN (hAN = fnButtonDown)
END

// Note: You may have to call DspRegisterMouseDown manually to have the button animate correctly at

// runtime, however during testing here it was shown not to be necessary.

 

Keywords:
 

Attachments