Cover image for Day 10 of #100DaysOfCode: Learn Monkey C- create a menu for CIQ application

Day 10 of #100DaysOfCode: Learn Monkey C- create a menu for CIQ application

jenhsuan profile image Jen-Hsuan Hsieh ・2 min read


We can use Monkey C and Connect IQ SDK to customize the appearance of Garmin devices. The article is the note for learning Monkey C.


It's a simple example for a Connect IQ application with simple menu. There are a few kind of objects in this example.

  • App.AppBase: entry point
  • Ui.View: menu or other views
  • Ui.MenuInputDelegate: the actions when the menu item is selected
  • module: stores static variables

Alt Text


1.Prepare the development environment

2.Prepare the manifest.xml and resources/menus/menu.xml

  • manifest.xml: specify the entry
  • resources/menus/menu.xml
<menu id="ExampleMenu">
    <menu-item id="room_1" label="Item 1" />
    <menu-item id="room_2" label="Item 2" />

3.Prepare main files

  • Module (Example)
using Toybox.System as Sys;
using Toybox.Communications as Comm;
using Toybox.Application;
using Toybox.WatchUi as Ui;
using Toybox.Timer as Timer;
using Toybox.UserProfile;

module Example {
    var roomId = -1;
  • Entry point (ExampleApp)
using Toybox.Application as App;
using Toybox.WatchUi as Ui;

class ExampleApp extends App.AppBase {

    function initialize() {

    // Return the initial view of your application here
    function getInitialView() {
        return [new ExampleAppMenu()];

  • Menu (ExampleAppMenu)
using Toybox.WatchUi as Ui;
using Toybox.System as Sys;
using Toybox.Timer as Timer;

class ExampleAppMenu extends Ui.View {

    function initialize() {

    function selectRoomMenu() {
        Ui.pushView(new Rez.Menus.ExampleMenu(), new ExampleAppMenuDelegate(), Ui.SLIDE_IMMEDIATE);
  • Actions (ExampleAppMenuDelegate)
using Toybox.WatchUi as Ui;
using Toybox.System as Sys;

class ExampleAppMenuDelegate extends Ui.MenuInputDelegate {
    function initialize() {

    function onMenuItem(item) {
        if (item == :room_1) {
            Example.roomId = 1;
        } else {
            Example.roomId = 2;

        Ui.pushView(new ExampleAppView(), new ExampleAppDelegate(), Ui.SLIDE_IMMEDIATE);

4.Compile and run on the simulator

  • That's it!

Alt Text


There are some of my articles. Feel free to check if you like!

Posted on by:

jenhsuan profile

Jen-Hsuan Hsieh


6+ year work experience in the software engineering field. 2+ year work experience with front-end JavaScript framework like React.js, Knockout.js. and Microsoft solution.


markdown guide