CreateMenu -- create a menu strip (V6.0)
[id] = CreateMenu(id, table)
This function can be used to create a menu strip that can later be attached to one or more displays by calling SetDisplayAttributes() on an existing display or by specifying the Menu tag in the @DISPLAY preprocessor command or in the CreateDisplay() call.

You have to pass an identifier for the new menu strip or Nil. If you pass Nil, CreateMenu() will return a handle to the new menu strip which you can then use to refer to this menu strip.

You also need to pass a table containing the actual menu tree definition to this function. Menus are defined as a tree structure that is composed of a master table that contains various subtables. See MENU for a detailed description of menu tree tables.

This command is also available from the preprocessor: Use @MENU to create menu strips at startup time!

identifier for the menu strip or Nil for auto id select
menu tree definition
optional: identifier of the new menu; will only be returned when you pass Nil as argument 1 (see above)
CreateMenu(1, {
    {"File", {
        {"New", ID = "new"},
        {"Open...", ID = "open"},
        {"Close", ID = "close", Flags = #MENUITEM_DISABLED},
        {"Save", Flags = #MENUITEM_DISABLED, Hotkey = "S"},
        {"Compress", ID = "cmp", Flags = #MENUITEM_TOGGLE},
        {"Export image...", {
            {"JPEG...", ID = "jpeg"},
            {"PNG...", ID = "png"},
            {"BMP...", ID = "bmp"}}},
        {"Dump state", ID = "dump"},
        {"Quit", ID = "quit", Hotkey = "Q"}}},

    {"Edit", {
        {"Cut", ID = "cut"},
        {"Copy", ID = "copy"},
        {"Paste", ID = "paste"}}},

    {"?", {
        {"About...", ID = "about"}}}

SetDisplayAttributes({Menu = 1})
The code above creates a menu strip and attaches it to the current display.

Show TOC