Jump to content

WinCC Button BAckground color using vb or c


Recommended Posts

Posted (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 by m1n1
Posted
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.

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...