Sunday, 20 July 2014

Application Development : Controls – Slider

Slider 
A Slider is a control that allows the selection of a value from a range of values (see Figure 1). You can set the range using the fromValue and toValue properties. You can handle the value using the onImmediateValueChanged signal handler. In practice, you will have to round to the closest integer the immediateValue passed to the handler (see Listing 1).
Figure 1. Slider
Listing 1.  Slider
import bb.cascades 1.0
Page {
    Container {
        TextField {
           id: texfield
        }
        Slider{
            id: slider
            fromValue: 0
            toValue: 100
            onImmediateValueChanged: {
                texfield.text = Math.round(immediateValue)
            }
        }
    }
}
Use a slider when a user needs to quickly set a value from a predetermined range of values.

No comments:

Post a Comment