Dynamic Menu: supports CIQ1, sublabels, icons, add/edit/delete items on the fly

Dynamic Menu is a CIQ class that implements a menu which gives you advanced CIQ3 Menu2-like features, but in CIQ1. Dave Baldwin gets all the credit for the initial project and the bulk of the work. I have added a few things, like preventing crashes, and adding proper touchscreen support.

Since I made some fixes and used the code in my own project to implement a settings menu, I wanted to share it with everyone here.

The original repo is a little bit behind, so here's a link to my fork:
https://github.com/flowstatedev/Dmenu [IMG2=JSON]{"data-align":"none","data-size":"full","src":"https:\/\/i.postimg.cc\/fRN55XY3\/dmenu-f3.png"}[/IMG2]


Features
  • Supports all watches, including CIQ1/2 devices
  • Looks like the native menu on modern watches (645, VA3, 935, Fenix 5)
  • Supports adding/deleting/changing items on the fly (after menu has been created)
  • Supports sub labels. Each item has a title and sub label
  • Supports icons or anything else you want to draw (like checkboxes), by overriding the item's draw() function. This way you can have items that draw themselves dynamically.
  • Proper touchscreen support: swipe UP/DOWN to scroll; or tap above/below center item. Just like native menus on VAHR, FR630, etc.

The one major problem is that animation doesn't work on older watches, but that is a firmware issue. To that end, I have disabled animation by default in the code.

Other known issues
  • All 3 items are the same size. In the real watch the middle item should be about 40% of the total height.
  • Dynamic Menu looks the same on all watches, which is okay if you have a Fenix 3 or modern watch. If you have a 230/630/etc., it will look different than the native menus.

(Sorry for the repost, but maybe it wasn't clear what Dynamic Menu does in the previous post.)
  • This was very useful for me.

    Compared to Menu2, Garmin's Menu is kind of grim... This let me have something that looked like Menu2.

    I modified the code work better with the larger screens and look more like how Menu2 looks on the 520 plus.
  • dpawlyk glad you found it useful! If you want, feel free to submit a pull request for your changes and I'll see if I can incorporate them.

  • I rejiggered some things that (probably) make my changes not compatible with the original code. (I set it up so the code is more like Menu2.) I also can't be sure that my changes didn't break stuff other people might be using that I am not.

    As I added more features, using Menu2 better, the gap between the Menu2 and Menu version made the Menu version of my app very weak. I was able to use Dynamic Menu to fix that very nicely.
  • dpawlyk no worries. It often isn't easy to release personal code in a way that's generic and useful to others. I have my own private version of DMenu with some omitted code to save memory, which isn't trivial to do in a pseudo-library like this. (I don't want to use a barrel, which comes with its own overhead).

    Yeah, there are some things, like a simple settings menu (similar to the native settings menu), which are pretty much impossible to do properly with the original Menu. My ideal version of Dynamic Menu would look and feel just like the native menu on all or most devices, but seeing as there's little demand/interest (and I don't have access to all the different devices), it would probably never happen. Although a lot of the cosmetic differences are easy to eyeball by looking at YouTube videos, etc.
  • I didn't expect you would have any worries (I have no problem assuming you are reasonable!).

    I spent about two months writing my app. And working with Monkey C isn't as easy as working with C#.

    The main issue with Dynamic menu was that it treated big screens like watches.

    It wasn't, though, that hard to make it work reasonably on big screens (I managed to do it).

    Honestly, making it work "just like" the native stuff (Menu2?) would be nice but probably not worth spending much time on. I got it to look fairly close to Menu2 on the 520+.

    In any case, your excellent work allows my app to be almost the same on devices without Menu2 as it is on those with it.

    It would have had to spend much more time to get that to happen (I probably would not have done it).


    My first attempt at using DMenu was seriously unsuccessful (probably due to being less familiar with the Monkey C stuff). Seeing how well my app worked with Menu2 made me try again. It wasn't hard the second time!
  • dpawlyk well, I'm def glad it was useful for you, as I found Dynamic Menu useful as well.

    Like I said, the bulk of the work was done by the original author, Dave Baldwin. However, there was a random crashing issue in the original code and proper touchscreen support was not there (probably due to the author testing on a Fenix 3). I'll be honest and say that if Dynamic Menu didn't already exist, I may not have written it in a form that would be easy to share with others, so I'm happy that was already done for me.