Documentation Archive Developer
Search

ADC Home > Reference Library > Technical Q&As > Legacy Documents > Mac OS 9 & Earlier >

Legacy Documentclose button

Important: This document is part of the Legacy section of the ADC Reference Library. This information should not be used for new development.

Current information on this Reference Library topic can be found here:

Maximum Number of Menu Items


Q: Can the standard Macintosh menu definition function ('MDEF') handle menus with more than 255 items? If not, how can I write code to do this?

A: The standard MDEF has a hard limit of 255 items. To handle more than this number, you will have to write your own MDEF.

Apple advises against writing an MDEF that handles more than 255 items because the speed of menu drawing, scrolling, and highlighting will tend toward unacceptably slow. Also, selecting from a menu which has more than 50 or so items is a very unpleasant experience for the user.

(If your interface lets users add items to a menu and the user commonly chooses to add more than 50, you should think about whether there is a better way to provide interface for the functionality in question. However, allowing users to add "too many" items of their own accord is certainly better than burdening them with that many items without asking permission first.)

A better method of choosing from large numbers of items, such as fonts, would be to allow the user to select from a scrolling list presented in a dialog. Key presses in the dialog would scroll the list to match (similar to the file list in Standard File).

Finally, really cool applications would allow users to customize the Font menu, preferably both for the application's default and for each document. Users would be able to choose which fonts appeared in the Fonts menu but would still have access to the others via the scrolling list.

This does not rule out other methods that you may have thought of to relieve the user of wading through hundreds of items.

Further Reference:

Inside Macintosh: Menu Manager
Inside Macintosh: List Manager
Human Interface Guidelines

[Dec 22 1998]