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
  • Arriën,

    It's hard for me to understand exactly what you're trying to do. However, you should not need to have local variable tags with a genie. Normally you define the values as genie substitutions (like %Tag%). When you place the genie on the page you fill in the values for each of the substitutions for that copy of the genie. In the genie you can pass the substitution value to the Cicode function.

    For example, if you have a button in the genie to display the RTF, set the button command to KmrBzttngRichTextFileOpen("%AfdlngRTF%", "%KmrNr%", %AnNr%)

    That will pass the three substituted values to the Cicode function as text strings and AnNr as an integer.

    Then, set the Cicode function to accept the passed values and store them in Cicode variables. The Cicode variables do not have to have the same names:

    STRING msCurrentFile = "";
    
    FUNCTION KmrBzttngRichTextFileOpen(STRING sAfdlngRTF, STRING sKmrNr, INT hAN)
    
      IF msCurrentFile <> "" THEN
        DspDel(hAN);
      END
    
      msCurrentFile = "D:\CtKamerBezetting\" + sAfdlngRTF + "\" + sKmrNr + ".rtf";
      PageRichTextFile(hAN, msCurrentFile, 2, 200, 275);
    
    END
    
    

    I changed the function to just remove the RTF if one was already displayed and then show the new one. Is that what you want?

    You can delete any Local Variable Tags you have created for this genie.

Reply
  • Arriën,

    It's hard for me to understand exactly what you're trying to do. However, you should not need to have local variable tags with a genie. Normally you define the values as genie substitutions (like %Tag%). When you place the genie on the page you fill in the values for each of the substitutions for that copy of the genie. In the genie you can pass the substitution value to the Cicode function.

    For example, if you have a button in the genie to display the RTF, set the button command to KmrBzttngRichTextFileOpen("%AfdlngRTF%", "%KmrNr%", %AnNr%)

    That will pass the three substituted values to the Cicode function as text strings and AnNr as an integer.

    Then, set the Cicode function to accept the passed values and store them in Cicode variables. The Cicode variables do not have to have the same names:

    STRING msCurrentFile = "";
    
    FUNCTION KmrBzttngRichTextFileOpen(STRING sAfdlngRTF, STRING sKmrNr, INT hAN)
    
      IF msCurrentFile <> "" THEN
        DspDel(hAN);
      END
    
      msCurrentFile = "D:\CtKamerBezetting\" + sAfdlngRTF + "\" + sKmrNr + ".rtf";
      PageRichTextFile(hAN, msCurrentFile, 2, 200, 275);
    
    END
    
    

    I changed the function to just remove the RTF if one was already displayed and then show the new one. Is that what you want?

    You can delete any Local Variable Tags you have created for this genie.

Children
No Data