Widget color Toggle

Post your questions and help other users.

Moderator: Martin

Post Reply
User avatar
kvelez
Posts: 3
Joined: 23 Sep 2014 20:12

Widget color Toggle

Post by kvelez » 25 Sep 2014 10:18

Stumped on how Martin gets the rectangle color to change based on a Boolean value set by a widget. I am trying to create a similar one. Any ideas?

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Widget color Toggle

Post by Martin » 25 Sep 2014 13:52

Hi,

You could create a custom widget with a rectangle and change the color from a script using the function setWidgetElementProperty. Please use the button Function in the script action to insert the function since it will show a dialog that helps to select the widget, the element, the property and the color. You can use an if in the script to check a boolean variable and to set a different color. Something like this should work:

Code: Select all

flag = true;//resp. false
setWidgetElementProperty("Widget X", "Rectangle_X", "fillcolor", if (flag) "#ffff0000" else "#ff00ff00");
Regards,
Martin

Post Reply