vegUI.org home of the javascript based window manager and AJAX framework

Applying effects to template elements

written by vegu on 25 Jan, 2007 07:42:52
If you want to apply an effect to a vegUI element that you will use as a template to clone other elements you need to be a little tricky.

Effects do not get cloned nor can they be applied to templates (unbuilt elements). In order to add an effect to a template and then have that effect be "cloned" to any element that is cloned from that template we need to utilize an event.

The best event to use for this issue is the ondock event. The ondock event get's fired when the HTML node controlled by the element is appended to the document - in other words when it becomes visible on the page. The onbuild event would be okay in most cases also, but some effects wont work correctly - such as the shadow effect.

So to be sure we will use the ondock event.

Let's say we want to add the shadow effect to our window template and hence to all windows that will be cloned from this template.

Code: Javascript
winTpl.event_add(
'ondock',
function(a) { a[0].Manager.FX.effect_add(a[0], new VegUIFXShadow()); }
);


Since the ondock event will be cloned, every window that is cloned from winTpl will have a shadow effect added to it once it is docked to the document

Related Posts

  • No related posts



Your Comment

name:*
email-address:

Are you human?



Comments

No comments yet.