Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Posts: 324
Registered: ‎03-10-2010
My Device: Bold 9780, DevAlpha
My Carrier: Vodafone CZ
Accepted Solution

Slider with integer values only?

I want to create slider that accepts integer values only.


For example: from 1.0 to 5.0, step: 1.0


How to do this?

Posts: 30
Registered: ‎11-06-2012
My Device: BB 10 Dev Alpha
My Carrier: MegaFon

Re: Slider with integer values only?

In a word, DIY Smiley Happy There is no integer slider in Cascades.

Wrap the standard floating-point (continuous) Slider into you own class.
Listen to the valueChanged(float) and immediateValueChanged(float) signals.
Emit your own signals when slider moves from one discrete value to another.
Fix continuous slider position to the nearest discrete value in the valueChanged(float) signal handler.

For each continuous slider position you'll need to find the nearest discrete value.

Posts: 54
Registered: ‎10-26-2011
My Device: Playbook
My Carrier: Rogers

Re: Slider with integer values only?

This worked for me...and its easier!!


                            Slider {
                                id: slider
                                property int intValue : slider.immediateValue
                                fromValue: 0
                                toValue: 1000


Now instead of reading from immediateValue, just read from intValue.

Posts: 125
Registered: ‎03-06-2012
My Device: Z10
My Carrier: 3 Italia

Re: Slider with integer values only?

Thanks anhu for the tip!