Cicode Genie

hello,

i am trying to make a Cicode genie for a IF function.

so far this is the cicode i have:

FUNCTION KmrBzttngRichTextFileOpen()

IF +bsKmrNrRTF=1

THEN

DspDel (+AnNr)

+bsKmrNrRTF=0

ELSE

PageRichTextFile (+sAnNr, "D:\CtKamerBezetting\"+sAfdlngRTF+"\"+sKmrNr+".rtf", 2, 200, 275);

+bsKmrNrRTF=1;

End

End

so far most of it i got to work, both the path and the AnNr work.

how ever i cant get the "bsKmrNrRTF" to work.

the idea is that when i press on a grapical genie i put in a variable tag that has to be put in place of the "bsKmrNrRTF".

BsKmrNrRTF is at the moment a LOCAL INT adres.

but has to be replace with a Variable adres that gets its value from the PLC.

i wonder if there is a way to make this work? and what i could do to sort this?

thanks in advance.

Arriën

Parents
  • You just need to create the Cicode variable by declaring it above the function like this:

    INT bsKmrNrRTF = 0;
    
    FUNCTION KmrBzttngRichTextFileOpen()
    
      IF bsKmrNrRTF = 1 THEN
        DspDel(AnNr);
        bsKmrNrRTF = 0;
      ELSE
        PageRichTextFile(sAnNr, "D:\CtKamerBezetting\" + sAfdlngRTF + "\" + sKmrNr + ".rtf", 2, 200, 275);
        bsKmrNrRTF = 1;
      END
    END
    



    When it starts up, the value will be 0. When your function first gets called it will create the RTF object and set the value to 1. The next time your function is called it will see the value is 1 and delete the RTF object and set the value back to 0. Since it is a Cicode variable, each client computer will get its own copy so one client may have the RTF displayed and another may not. They will not conflict with each other.

Reply
  • You just need to create the Cicode variable by declaring it above the function like this:

    INT bsKmrNrRTF = 0;
    
    FUNCTION KmrBzttngRichTextFileOpen()
    
      IF bsKmrNrRTF = 1 THEN
        DspDel(AnNr);
        bsKmrNrRTF = 0;
      ELSE
        PageRichTextFile(sAnNr, "D:\CtKamerBezetting\" + sAfdlngRTF + "\" + sKmrNr + ".rtf", 2, 200, 275);
        bsKmrNrRTF = 1;
      END
    END
    



    When it starts up, the value will be 0. When your function first gets called it will create the RTF object and set the value to 1. The next time your function is called it will see the value is 1 and delete the RTF object and set the value back to 0. Since it is a Cicode variable, each client computer will get its own copy so one client may have the RTF displayed and another may not. They will not conflict with each other.

Children
No Data