Does anyone have an App that uses the NumberPicker? I wanted to see how it works.
Thanks
Ronnie
Does anyone have an App that uses the NumberPicker? I wanted to see how it works.
Thanks
Ronnie
Very easy to put one together yourself.
For example:
using Toybox.UserProfile; using Toybox.WatchUi; class Interactivity extends WatchUi.BehaviorDelegate { function initialize() { BehaviorDelegate…
In the API guide for NumberPicker, under "Supported Devices" click on "View Devices".
It's not available on lots of devices. Not really retired but also not available on newer devices…
Have you looked at the NumberPicker sample in the SDK?
Very easy to put one together yourself.
For example:
using Toybox.UserProfile; using Toybox.WatchUi; class Interactivity extends WatchUi.BehaviorDelegate { function initialize() { BehaviorDelegate.initialize(); } function onSelect() { // Docs say height is in cm, but picker appears to use meters... go figure. var h = UserProfile.getProfile().height/100.0; System.println("HEIGHT "+h); if(h == null) { h = 1.73; } var picker = new WatchUi.NumberPicker(WatchUi.NUMBER_PICKER_HEIGHT,h); var pickDel = new HeightChangesDelegate(); WatchUi.pushView(picker,pickDel,WatchUi.SLIDE_LEFT); } } class HeightChangesDelegate extends WatchUi.NumberPickerDelegate { function initialize() { NumberPickerDelegate.initialize(); } function onNumberPicked(value) { System.println("Number picked was "+value); System.println("... do something about it!"); WatchUi.popView(WatchUi.SLIDE_RIGHT); } }
And then, in your App class:
// Return the initial view of your application here function getInitialView() { return [ new WhateverYourViewClass(),new Interactivity() ]; }
That said...
It frustrates me that there is no way to edit the native NumberPicker!
I would really love to be able to select a range and set the title and use the existing class rather than needing to home cook one!
As a side note...
Has NumberPicker been retired? I got an error with Venu using 3.2 in the simulator saying there was no such class.
In the API guide for NumberPicker, under "Supported Devices" click on "View Devices".
It's not available on lots of devices. Not really retired but also not available on newer devices.
Not really retired but also not available on newer devices.
Actually, this has been formally deprecated for some time. NumberPicker and TextPicker were tagged for removal in ConnectIQ 3.0.0, but have not been removed.
This appears to be a bug with our documentation generator not honoring deprecated tags on classes (it is working for functions and variables).
Is there a recommendation / example code how to create a number picker nowadays?
You can start with the generic picker (the "picker" sample in the SDK) or do your own
I found this: github.com/.../text-picker