Anyone used a text picker on a vivoactive?

I through together a very simple app - and while something looking like a text picker pops up on simulator, but crashes on the real device.

Has anyone used a TextPicker on the va?

Here's the code:

class TPStock extends Ui.TextPickerDelegate {

function onTextEntered(text, changed)
{
Sys.println(text);
}
}

class Stock3Delegate extends Ui.BehaviorDelegate {

function onMenu() {
var tp = new Ui.TextPicker( "abc ");
Ui.pushView( tp, new TPStock(), Ui.SLIDE_IMMEDIATE );
}
  • Ok, so this is something missing on the vivoactive, as by testing using "has", the VA doesn't have a TextPicker. (Fw 2.70 that just came out a couple days ago...)
  • Sorry it took so long to respond. This works just fine on a 920XT w/ 3.20 firmware.

    using Toybox.Graphics as Gfx;
    using Toybox.System as Sys;
    using Toybox.WatchUi as Ui;

    // generic forwarding delegate
    class MenuDelegate extends Ui.MenuInputDelegate
    {
    hidden var menu;

    function initialize(menu) {
    self.menu = menu;
    }

    function onMenuItem(item) {
    return menu.onMenuItem(item);
    }
    }

    // generic forwarding delegate
    class TextDelegate extends Ui.TextPickerDelegate
    {
    hidden var picker;

    function initialize(picker) {
    self.picker = picker;
    }

    function onCancel() {
    return picker.onCancel();
    }

    function onTextEntered(text, changed) {
    return picker.onTextEntered(text, changed);
    }
    }

    class StockNamePicker extends Ui.TextPicker
    {
    hidden var view;

    function initialize(view) {
    self.view = view;

    var text = view.getText();
    Ui.TextPicker.initialize(text);
    }

    function onCancel() {
    }

    function onTextEntered(text, changed) {
    if (changed) {
    view.setText(text);
    }
    }
    }

    class SettingsMenu extends Ui.Menu
    {
    hidden var view;

    function initialize(view) {
    self.view = view;

    setTitle("Settings");
    addItem("Stock Name", :name);
    }

    function onMenuItem(item) {

    if (item == :name) {
    var picker = new StockNamePicker(view);
    Ui.pushView(picker, new TextDelegate(picker), Ui.SLIDE_IMMEDIATE);
    }

    return true;
    }
    }

    class TestDelegate extends Ui.BehaviorDelegate
    {
    hidden var view;

    function initialize(view) {
    self.view = view;
    }

    function onBack() {
    Ui.popView(Ui.SLIDE_IMMEDIATE);
    }

    function onMenu() {
    var menu = new SettingsMenu(view);
    Ui.pushView(menu, new MenuDelegate(menu), Ui.SLIDE_IMMEDIATE);
    }
    }

    class TestView extends Ui.View
    {
    hidden var text;

    function initialize() {
    text = "Hello World!";
    }

    function onUpdate(dc) {
    dc.setColor(Gfx.COLOR_BLACK, Gfx.COLOR_BLACK);
    dc.clear();

    var cx = dc.getWidth() / 2;
    var cy = dc.getHeight() / 2;

    dc.setColor(Gfx.COLOR_WHITE, Gfx.COLOR_TRANSPARENT);
    dc.drawText(cx, cy, Gfx.FONT_LARGE, text,
    Gfx.TEXT_JUSTIFY_CENTER | Gfx.TEXT_JUSTIFY_VCENTER);
    }

    function setText(text) {
    self.text = text;
    }

    function getText() {
    return text;
    }
    }
  • The TextPicker is not available on the vivoactive nor will it be, as it's not supported by the device. I thought the documentation mentioned this, but it's only mentioned in the readme. We'll get that corrected.
  • I through together a very simple app - and while something looking like a text picker pops up on simulator, but crashes on the real device.


    Is the app or the watch crashing when using the TextPicker?
  • Just the app. The "IQ" icon with a "!"

    If TextPicker will never be supported on the va, shouldn't it be caught somewhere before a va app that uses it winds up in the app store? The compiler or the simulator? Having it documented as not working doesn't prevent someone trying to use it in an app they test on a 920, but later check "vivoactive" as a build.
  • We're going to make the simulator more aware of device differences so it can be caught by the developer before publishing a broken app to the store.
  • Is this really a question of device differences, or is this a difference between firmware versions?

    Consider that the 2.70 firmware for the 920XT didn't support Ui.TextPicker, but 3.20 does. Having the simulator show the behavior of the latest firmware isn't that useful when a large number of users aren't using the latest. Is the simulator expected to provide functionality for simulating the various features available with each firmware release?

    Travis
  • Is this really a question of device differences, or is this a difference between firmware versions?

    In this case it's device differences. Ui.TextPicker isn't planned to be available on the vivoactive.

    Is the simulator expected to provide functionality for simulating the various features available with each firmware release?

    No, the simulator will not handle device firmware differences. We've talked about how to enforce a device upgrade before running an app that requires newer firmware to run correctly, so it's on our radar as an issue.
  • Ui.TextPicker isn't planned to be available on the vivoactive.

    Wow. Mind = Blown.
  • For the record, I'm just the messenger. I'll bring the lack of the text picker up again and see what can be done about it.

    The reason it's not available is due to the lack of a native text picker on the vivoactive. All of our Ui Views (Progress Bar, Menu, Confirmation, etc) are built upon the native pages on each device, and the vivoactive lacks this page. Unfortunately it's a bit more complex than just flipping a switch to bring Ui.TextPicker into the vivoactive.