Welcome, Guest
Please Login or Register.    Lost Password?

Widget Dynamic Background
(1 viewing) (1) Guest
Go to bottomPage: 1
TOPIC: Widget Dynamic Background
#8654
Widget Dynamic Background 5 Years, 6 Months ago  
I was able to recycle some of the Shadow4 widget code and make a new widget that shows only the current Environment Canada weather warning for my forecast area. At first I tried to integrate it with the existing weather widget, but I soon realized making a separate widget would be easier.

It works fine, but I would like to go one step further and try to change the background of the widget dynamically to reflect the warning status. If there is no warning, the text displays "No watches or warnings in effect." If there is a warning, it will display "BLIZZARD WARNING" or "TORNADO WATCH", etc. Only when a watch or warning is issued, do I want the background to change to another color, in this case: red.

I have the normal grey background and red background ready to go.

Now how do I set a variable in the LUA script, AND get the XML file to "listen" to the variable and display the correct background image? I was trying to set a variable basically saying

if warningtext = "No watches or warnings in effect." then
background = grey
else background = red
end

And call the background from the XML file but alas no dice.



Any tips, please and thank you!
MacGyver
Fresh Boarder
Posts: 3
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#8657
Re:Widget Dynamic Background 5 Years, 6 Months ago  
Figured it out, I was setting the text property instead of the element property. Now it works. I'll post it when I get all the bugs worked out.
MacGyver
Fresh Boarder
Posts: 3
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
Go to topPage: 1
get the latest posts directly to your desktop