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
  • Try deleting this line from RTFSave():

    msCurrentFile = "D:\CtKamerBezetting\"+sAfdlingRTF+"\"+ sKmrNr+".rtf";

    After you save the file and delete the RTF display you don't want to set the current file string since there is no current file displayed. When you run RTFOpen, if it sees text in msCurrentFile, then it thinks that you have a file displayed and it needs to delete it.

    Also, look at the example KmrBzttngRichTextFileOpen() function in my last message. I changed the IF statement so if the file was currently displayed it would delete it, and it would open the file immediately after that. You did not have to call the function twice. In your function you used an IF/ELSE statement so it would either delete or open a file but it would not do both things.
Reply
  • Try deleting this line from RTFSave():

    msCurrentFile = "D:\CtKamerBezetting\"+sAfdlingRTF+"\"+ sKmrNr+".rtf";

    After you save the file and delete the RTF display you don't want to set the current file string since there is no current file displayed. When you run RTFOpen, if it sees text in msCurrentFile, then it thinks that you have a file displayed and it needs to delete it.

    Also, look at the example KmrBzttngRichTextFileOpen() function in my last message. I changed the IF statement so if the file was currently displayed it would delete it, and it would open the file immediately after that. You did not have to call the function twice. In your function you used an IF/ELSE statement so it would either delete or open a file but it would not do both things.
Children
No Data