Chapter 17. Menus in Windows
This chapter discusses three built-in control classes that display menus in windows: PopupMenu, BevelButton, and ContextualMenu.
A PopupMenu is a RectControl, and therefore receives all the events and has all the methods and properties listed in Chapter 10: Open and Close events; Visible, Enabled, and AutoDeactivate properties; Top, Left, Height, and Width properties; LockLeft, LockRight, LockTop, and LockBottom properties; MouseEnter, MouseMove, and MouseExit events; and Refresh and RefreshRect methods.
A BevelButton is a RectControl too, and it’s also a button. For its button-related aspects, see Chapter 12.
PopupMenu
A PopupMenu displays itself as a roughly rectangular region of the window, usually containing some text (its caption), and with an arrow at its right end. (To eliminate the display of the caption, narrow the control to about 20 pixels, which should cause it to consist of just the arrow.) When the mouse is depressed within an enabled PopupMenu’s boundaries, the PopupMenu takes on a depressed or highlighted appearance and displays a menu. When the mouse is subsequently released, the menu vanishes; if the mouse was released over a menu item, the text of that item becomes the caption, and the next time the menu is shown, that item will have a check mark or some similar indicator next to it. Figure 17-1 shows an example.
Figure 17-1. A PopupMenu ...
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.