m1n1 Posted June 22, 2006 Report Posted June 22, 2006 (edited) What i would like to do is to change the background colour of a button when a marker bit in the plc is 1. The tag that is addressed to this bit is called "test" I would like to do it with either vb or c script. Has anybody got any simple code that would do this. Also any documentation using vb or c with WinCC would be greatly appreciated. Thanks Edited June 22, 2006 by m1n1 Quote
stplanken Posted June 28, 2006 Report Posted June 28, 2006 Usually I add a little script to the button's "display" property, something like this: const TAG_NAME = "yourtag_name_here" dim oTag set oTag = hmiruntime.tags(TAG_NAME) oTag.read if oTag.value = 1 then item.backcolor = vbred else item.backcolor = vbgreen end if Dont forget to enter the tag name as the trigger (best to avoid cyclic triggers). You could also use the dynamic properties, depending on the "style" of the button. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.