##
Simple Menus

The simplest menu example
, just uses the "helloworld" example, but add a menu with three buttons to change the color of the map
. The code is very simple. A menu is created with pairs of text/functions:

    var m = new menu("red",setRed,"green",setGreen,"blue",setBlue)

Each pair consists of the text that is put on the button, and a user defined function that is called when the button is clicked. The three functions just set the color or the map and submit the window, e.g. for blue:

    function setBlue()
        w.setVar("map_countries_class_color","0 0 255")
        w.submit()
    }

Menus are not visible by default: most menus you create will be submenus that appear from other menus and disappear when clicked. A menu that should stay on screen has to call two additional methods:

    m.realSticky(true)    // menu remains on screen with blue border
    m.showAt(left,top)    // initial position

Once the menu appears on screen, it can be moved
or toggled from horizontal to vertical (shift-click the blue border).