Is it possible to decorate Menu2?

I have a "status indicator" ring in my app. It looks like this red ring:

I'd like to add this indicator (can be no ring, red ring or yellow ring) to a few more "views". The problem is that some of them are Menu or Menu2. Even though Menu2 extends View, it looks like onUpdate is never called. Nor does it work if I call setLayout. Here is my class:

    class ExitMenu2View extends WatchUi.Menu2 {
    	public var statusIcon as Drawable?;

        function initialize() {
            log("ExitMenu2View()");
            Menu2.initialize(null);
            setTitle(Rez.Strings.appName);
            addItem(new WatchUi.MenuItem(Rez.Strings.menuResume, null, :resume, null));
            addItem(new WatchUi.MenuItem(Rez.Strings.menuSave, null, :save, null));
            addItem(new WatchUi.MenuItem(Rez.Strings.menuDiscard, null, :discard, null));
            addItem(new WatchUi.MenuItem(Rez.Strings.menuSettings, null, :settings, null));
        }

        function setStatusIcon(statusIcon as Drawable?) as Void {
            log("ExitMenu2View.setStatusIcon: " + statusIcon);
            self.statusIcon = statusIcon;
            setLayout(statusIcon != null ? [statusIcon] : null);
        }

        public function onUpdate(dc as Dc) as Void {
            log("ExitMenu2View.onUpdate");
            Menu2.onUpdate(dc);

            drawStatusIcon(dc, statusIcon);
        }
    }


Any idea if this is possible at all, and if yes then how? I hope there's a solution without completely rewriting Menu2 on my own.

  • Even though Menu2 extends View, it looks like onUpdate is never called.

    I'm guessing that's because Menu2 is some sort of wrapper around a native view, so rendering probably isn't done in CIQ code.

    I think ProgressBar is another example of a CIQ wrapper around a native view.

    Any idea if this is possible at all, and if yes then how?

    Maybe try View.addLayer() to add your custom view on top of a Menu2?

    I have no idea if this would work as I haven't tried it myself. But it would be nice if you could add a non-native CIQ View as a layer on top of a native view like Menu2.

    I imagine it might not work, for the same reason that overriding onUpdate doesn't work.

    You could also try adding Menu2 as a layer on top of another view.

    e.g.

    - Base view: (maybe this just renders nothing)

    - Menu2: layer on top of base view

    - status indicator: another layer on top of base view