Quote:
Originally Posted by Daveb
Sergio;
I have been playing around with your background method. I am having trouble with getting the image to pull in from the repository without refreshing the interface. Are you still using the same method with your revised interfaces or have you moved away from the repository method?
|
Yeh, I had the same issue you do. So what I did to get around the issue is the following:
1- Use a static image widget for your "background" image. Don't set the template background image. Send this static image to the back and give the widget a name. I guess you can pick a default image for this widget from the image repository.
2- Create a boolean field in a variable driver of some sort. Leave the default value as false.
3- Add a trigger on the new boolean field you just created to fire when IsTrue.
4- Create another field in the var driver that will hold the background image location. So this would be a string field. Set a default image location if you want to.
So the logic flow would be as follows:
1- After a user picks a background they want, I set the var driver field with the new image location that was selected. There is also a command you can send the driver to set the default value for the var driver so that the new background location doesn't change back to the old default when you reboot your system. I think it's something like this:
Devices::SendDrvCmd
P1=CQC_Variables
P2=SetFldDefault
P3=Zone%(GVar:intZone)_Background
Lastly, I set the boolean field in the var driver to true. This then fires an event. I close the pop-up.
2- I then trap that event in the template event system. I read the image location from the var driver. I set the background image widget to the new background image. That's why I had to use an image widget. I have no command to set the background image for the template in the event actions. Lastly, I change the boolean field in the var driver back to false so that it can trigger the next time a change is made.
It's kind of a round about way of doing it but all screens will now update automatically when you select a new background. You can also add logic to present screen/user specific backgrounds very easily using this method. You would just need to create a couple of extra string fields in the var driver for each user and set their default background. Add logic in the fired event commands to decide which background image to use.