Skip to content

menuslib

A menu list is a Blitz object, numbered from 0. MenuTitle adds a menu, MenuItem and ShapeItem add items to it, and SubItem and ShapeSub add subitems to an item; menus, items and subitems are numbered from 0, menu 0 on the left and item 0 at the top. SetMenu gives the menu list to the used window; a window has one menu list at a time. The menus appear while the user holds the right mouse button. When the user picks an item, the window reports an event of class $100 (part of the default IDCMP flags), and MenuHit, ItemHit and SubHit of the window library tell which item it was.

An entry is placed after the ones before it, so they are best made in order; making an entry again with the same number replaces it. The flags of an item choose its kind; a value larger than 4 is taken as Intuition’s item flags themselves:

FlagsItem
0an ordinary item
1an item that toggles a check mark
2an item that toggles a check mark and clears the others of its menu when it is checked
3as 1, but checked at the start
4as 2, but checked at the start

Menu, item and subitem numbers are checked only with runtime error checking; without it, a wrong number reads beyond the end of the lists (#416).

Based on the menuslib guide by Acid Software.

Library number 136. It manages MenuList objects, by default at most 5 (the compiler options set the maximum).

Commands

MenuChecked

True (-1) if the toggle item or subitem is checked, else false (0).

Function, result .w. Help text: (MenuList#,Menu,Item[,Subitem])
2 forms:

  • .w, .w, .w
  • .w, .w, .w, .w

MenuColour

The colour of the texts of the items and subitems made from now on.

Statement. Help text: Colour
Arguments: .w

MenuGap

The space around the text or shape of the items and subitems made from now on.

Statement. Help text: X Gap,Y Gap
Arguments: .w, .w

MenuItem

Adds a text item to a menu, or replaces it, optionally with a keyboard shortcut, the first character of Shortcut$, used with the right Amiga key.

Statement. Help text: MenuList#,Flags,Menu,Item,Itemtext$[,Shortcut$]
2 forms:

  • .w, .l, .w, .w, $
  • .w, .l, .w, .w, $, $

MenuList

The object that holds a list of menus made with the commands of this library, as the introduction describes.

Object name. Help text: List of Menus

MenuState

Enables or disables the whole menu list, a menu, an item or a subitem.

Statement. Help text: MenuList#[,Menu[,Item[,Subitem]]],On|Off
4 forms:

  • .w, .w
  • .w, .w, .w
  • .w, .w, .w, .w
  • .w, .w, .w, .w, .w

MenuTitle

Adds a menu with its title to the menu list, or replaces the menu with that number.

Statement. Help text: MenuList#,Menu,Title$
Arguments: .w, .w, $

The width of a title is computed for a font eight pixels wide.

SetMenu

Gives the menu list to the used window, in place of the menus it had; all items of a menu, and of each subitem list, get the width of the widest of them.

Statement. Help text: Menulist#
Arguments: .w

ShapeItem

Adds an item that shows a shape instead of a text; the flags are those of MenuItem.

Statement. Help text: MenuList#,Flags,Menu,Item,Shape#
Arguments: .w, .l, .w, .w, .w

ShapeSub

Adds a subitem that shows a shape instead of a text; the flags are those of MenuItem.

Statement. Help text: MenuList#,Flags,Menu,Item,Subitem,Shape#
Arguments: .w, .l, .w, .w, .w, .w

SubItem

Adds a text subitem to an item, or replaces it, optionally with a shortcut as MenuItem.

Statement. Help text: MenuList#,Flags,Menu,Item,Subitem,Subitemtext$[,Shortcut$]
2 forms:

  • .w, .l, .w, .w, .w, $
  • .w, .l, .w, .w, .w, $, $

A replaced subitem moves the subitems behind it by the change of its height.

SubItemOff

The offset of the subitems made from now on from their item.

Statement. Help text: X Offset,Y Offset
Arguments: .w, .w