Chapter 6. Menus

Earlier chapters have introduced windows, controls, classes, and subclasses. There is one component of every project that has not yet been discussed—menus. That’s what this chapter is about. It describes how menus are created and edited in the IDE, how your application enables menu items, how your application responds when the user chooses a menu item, and how your application modifies its menu items while running.

Menu Overview

Menus are a familiar feature of the Macintosh GUI. When an application is running, the texts of its menus—the File menu, the Edit menu, and so on—appear across the top of the main screen. These are commonly thought of as the names of the menus. However, REALbasic uses the term name to mean a menu item’s unique identifier as seen by the programmer and the code; what the user sees is called the menu or menu item’s text . Since REALbasic has a project component called a menubar, I refer to the place where the menus appear as “the top of the screen.”

On Windows, the menus appear at the top of a window, not the top of the screen. If you are using the multiple document interface (the MDI ), this window is a containing window, which holds all the document windows of your application, much like a Macintosh screen—though modal and floating windows still appear outside it. (You elect to use the MDI in the Build Application dialog; see Section 8.4.) If you’re not using the MDI, the menus appear only at the top of the default ...

Get REALBasic: TDG, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.