View Full Version : Dynamic Skinning
johncorro
05-12-2004, 11:44 AM
I'm a newbie to Laszlo and am evaluating it's various features. One thing I was wondering about was it's ability to dynamically change it's skin.
It appeared that the documentation advocated changing the actual core images as the easiest thing to do if the intent was to just change from Laszlo's default skin. However, it went on to say that more in-depth knowledge of how the graphical components were constructed was needed if dynamic skinning was needed. After that I couldn't seem to find a clear path on how to do dynamic skinning.
So dynamic skinning *appears* possible, but just not very easily. Can someone confirm this? If it is easy, can someone please point me to a code example or documentation on how it's done? Thanks.
So dynamic skinning *appears* possible, but just not very easily.
I don't agree with you. when you want to set the background image of a view, you just have to use the setSource(path) method at runtime, and that's it.
skinning is that simple...
johncorro
05-12-2004, 01:08 PM
Oh wow....that seems easier than anything I've seen in the HTML world. So if I understand correctly, I could set the resource on the view and all other components will inherit from view. Is this correct? Again, I'm completely new to this so I may have things misworded or flat out wrong :)
antun
05-12-2004, 01:13 PM
I'm a newbie to Laszlo and am evaluating it's various features. One thing I was wondering about was it's ability to dynamically change it's skin.
I think you're referring to the default components, right? Things like Window, combobox, etc.? Just to set the record straight, the components are not Laszlo. The components are all written in LZX, and you use them when writing Laszlo apps, but the LPS itself is a platform upon which they are written, and in which they are used. What that means is that you can look at the source code for (say) window, make a copy of it and tweak it to suit your needs.
If you check out the Art Assets tutorial, you'll get a picture of how you can load art assets in at runtime:
http://www.laszlosystems.com/developers/learn/documentation/tutorials/art_assets.php
... which is one way you might write a window class that can load different images in after the app is loaded.
Alternatively you could use states if you knew how many different skins you wanted to support.
So yes it is possible, but it does involve tweaking the components code to suit your needs.
-Antun
johncorro
05-12-2004, 09:43 PM
Ok, so now I'm at the point to where I've seen how Laszlo performs includes and allows for changing of images (for an alternate skin) via the resource attribute.
From what I've read, it looks like encapsulating my various skinable items into a library is going to be the most OO way of going. What I haven't see is how to dynamically point to different libraries from a particular view.
Specifically I'm trying to set up an architecture in a Java web app where I keep a Preferences object (which in turn contains the user's selected skin) in session. How could I (at runtime) reference the session-persisted Preferences object and change which library to load given this approach?
antun
05-13-2004, 08:41 AM
I think this is the crux of your question:
How could I (at runtime) reference the session-persisted Preferences object and change which library to load given this approach?
You should write a JSP interface to the Preferences object that returns XML. In your Laszlo app, you'd make a request to that page and obtain the user's preferences.
-Antun
vBulletin® v3.8.4, Copyright ©2000-2012, Jelsoft Enterprises Ltd.