【问题标题】:Garmin and Monkey C "Cannot find symbol ':setText'..."Garmin 和 Monkey C \“找不到符号 \':setText\'...\”
【发布时间】:2023-02-14 16:05:15
【问题描述】:

我想尝试 garmin Watch Face 并很快遇到 folgenden 错误,但不幸的是我不知道为什么会这样,也许有人可以帮助你?

Cannot find symbol ':setText' on type 'PolyType<Null or $.Toybox.WatchUi.Drawable>'

我使用以下代码:


    function onUpdate(dc as Dc) as Void {
        setClockDisplay();
        setDateDisplay();
        setBatteryDisplay();
        setStepCountDisplay();
        setStepGoalDisplay();
        setNotificationCountDisplay();
        setHeartrateDisplay();
            // Call the parent onUpdate function to redraw the layout
        View.onUpdate(dc);
    }

    private function setClockDisplay() {
        var clockTime = System.getClockTime();
        var timeString = Lang.format("$1$:$2$", [clockTime.hour, clockTime.min.format("%02d")]);    
        var view = View.findDrawableById("TimeLabel");  
        view.setText(timeString);
    }    
}

为所有 .setText() 抛出错误。在这种情况下9次

我已经尝试了我能想到的一切。

【问题讨论】:

    标签: javascript c++ garmin watchface monkeyc


    【解决方案1】:

    以下解决了问题:

    改变

    var view = View.findDrawableById("TimeLabel");
    

    进入

    var view = View.findDrawableById("TimeLabel") as Text;
    

    不!

    【讨论】:

      猜你喜欢
      • 2014-09-05
      • 1970-01-01
      • 2014-01-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-04-11
      • 2015-11-12
      • 1970-01-01
      相关资源
      最近更新 更多