You are here: Overview > Widget Skins > Dynamic Skinning

Dynamic Skinning

A widget can have more than one skin associated with it. Dynamic Skinning allows you to change the skin of a widget during program runtime.

Skins must still be created in Visualizer. It is not possible to create a skin from code, and it is not possible to change skin properties from code.

For example, the following code allows you to change the skin for successful and unsuccessful dial attempts for a button in a Phone Widget,:

function clickphone() {
    retvalue = phone.dial("555-2368");
    if (retvalue == -1) {
        frm1.btn1.skin = "errorskin";
    } else {
        frm1.btn1.skin = "successskin";
    }
}

In the above code snippet, if the dial attempt is a failure, the errorskin is applied on the button. If the dial attempt is a success, the successskin is applied.

Note: For Dynamic Skinning, you must ensure that the skin exists for the widget in the IDE before the code is executed.

The following table lists the widgets and platforms which support dynamic skinning:

Widget Android/
Android
Tablet
BlackBerry iPhone
/iPad
Windows Mango/
Windows
6.x
Mobile Web SPA/Playbook
Form Yes Yes Yes Yes Yes Yes
HBox Yes Yes Yes Yes Yes Yes
VBox Yes Yes Yes Yes Yes Yes
Button Yes Yes Yes Yes Yes Yes
Calendar Yes Yes Yes No Yes Yes
CheckBoxGroup Yes Yes Yes No Yes Yes
ComboBox No Yes Yes No Yes Yes
Image Yes No Yes No Yes Yes
Label Yes Yes Yes Yes Yes Yes
Line Yes No Yes No No No
Link Yes Yes No No Yes Yes
ListBox Yes Yes Yes No Yes Yes
RadioButtonGroup Yes Yes Yes No Yes Yes
Rich Text Yes No No No Yes Yes
TextArea No Yes Yes No Yes Yes
TextBox No Yes Yes No Yes Yes
ScrollBox Yes Yes Yes Yes Yes Yes
Signature No No No Yes(supported on 6.x) No No
Video No No No No Yes Yes

prem Copyright © 2012 Kony, Inc. All rights reserved.
prem Copyright © 2012 Kony, Inc. All rights reserved.