Garmin and Monkey C "Cannot find symbol ':setText'..."

1k views Asked by At

I want to try a garmin WachFace and came across very quickly folgnden error, but unfortunately I do not know why it occurs, maybe someone can help you?

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

I use the following code:


    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);
    }    
}

The error is thrown for all .setText(). In this case 9 times

I have tried everything I could think of.

1

There are 1 answers

0
Mallalei On

the following solves the problem:

change

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

into

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

done!