Some UcompOSStyleProxy Basics
If you are a regular reader of this blog, you know that a lot of blogs have been dedicated to talking about the UcompOS Proxy components. However, one component that hasn’t received a lot of attention so far is the UcompOSStyleProxy.
The UcompOSStyleProxy provides a means to manage the style properties of the UcompOS Main Container. For instance, you can use the UcompOSStyleProxy to override the default background image on the UcompOS Main Container or set fade in\out duration effects on UcompOSWindowProxy instances.
To demonstrate the two behaviors above, let’s take a look at a simple UcompOSStyleProxy code example. First, in my UcompOS instance, I have created a simple HTML application called styler.html that is loaded as a background application by my dockManifest.xml file. The code in my styler.html application is fairly simple and easy to follow as evidenced by the following sample code:
//instantiate the UCompOSSDK
//instantiate a UcompOSStyleProxy instance that we can apply styles to
var styler = new UcompOSStyleProxy();
//set the default background image to Picture1.jpg at the correct file path on the server
//now, set the UcompOSWindowProxy instances to fade in\out 3 seconds
Hopefully, this example is simple enough to follow along with fairly easily; the mechanics involved are designed to be as straightforward as possible. However, one could easily envision scenarios where a user’s preferences are saved in a database and loaded at run-time by turning styler.html into a scripted application using PHP, PERL, or the language of your choice. Or, perhaps you may look at setting and instantiating style properties at startup using your dockManifest. The choice is up to you!
Note also that it is also possible, for example, to change the color of text on the menu bar by using some code like (using our example above):
You will want to keep in mind, though, that it is likely that the UcompOSStyleProxy class will continue to evolve in such a way that setting styles in this manner may not work in the future. Therefore, this practice is not recommended at this time. However, you will want to stay tuned to the updates that are made to this class as the UcompOS SDK continues to mature over the coming months.