Dynamic Menus

Former Member
Former Member
As a follow up to my earlier post about emulating timer menu behaviour and finding out you have to 'roll your own' I have done this and made it available at https://github.com/davebaldwin/Dmenu

From the readme:

DMenu.mc is an implementation of a dynamic menu where the menu ordering and length can be changed and an optional value line can be shown below the menu item name.

It is similar to how the Alarm Clock menu (menu -> Clock -> Alarm Clock) works. The only feature not supported is showing a status icon.

This has only been tested on a fenix3 and on the simulator (for a fenix3), although I don't think there is any device specific code.

One thing I noticed in the simulator is if the ANIM_TIME constant is made 0.2 then there are drawing errors but on the actual watch there are none (it is set to 0.3).

A rather trivial app is included to demonstrate its use.


Dave.
  • Thanks for posting, any idea if you can add an image to the menu item?

    Hi Dave,

    Thanks for sharing your code for your Dynamic Menu, it's just the sort of example I was looking for which is great.

    I would like to be able to dynamically add PNG icons to my menu, do you have any idea if it is possible? The images would be downloaded via a web request and hence would not be pre-compiled resources.

    Cheers,

    Chris
  • Former Member
    Former Member over 8 years ago
    Hi Chris,

    It looks like you are asking 2 questions.

    1. Adding icons to menus. I have refactored DMenu so the responsibility for drawing the menu contents now lies with DMenuItem class. By extending this class and augmenting or replacing the various drawing functions you can achieve this and a lot more. The sample app shows this in action by drawing an icon in every other alarm. The docs have been improved to talk about this.

    2. Downloading a bitmap from the web - sorry I cannot help here.


    Dave.
  • Thanks for your reply.

    Hi Dave,

    Thank you for your reply, I will try and take a look at your sample code over the next couple of days, I took a quick look last night and had roughly figured out the part 1 answer :)

    Like you said, part 2 is a mystery, I have raised a separate ticket to make it easier to find / more obvious that it's a different question.

    Thanks again,

    Chris