you can look at the attached 3 pictures and you will find the final code.
Two comments:
1)
If you add picturenames with defines, you should place the define between the associated WINCC... START/END comments.
If you use a picture names:
Code:
// WINCC:PICNAME_SECTION_START
#define PIC_1 "myPic1.pdl"
// WINCC:PICNAME_SECTION_END
Code:
// WINCC:TAGNAME_SECTION_START
#define TAG_1 "myTag1"
// WINCC:TAGNAME_SECTION_END
2)
I would use a switch/case statement instead of if-then.
Code:
switch (val) {
case 0:
OpenPicture(PIC_1);
break;
case 1:
OpenPicture(PIC_2);
break;
case 2:
OpenPicture(PIC_3);
break;
}
A switch statement is if there are consecutive case-values, compiled into a jump-table, which is fast and efficient.
And that's the common used way in C.