Menu Object
Parents Children Properties Methods Events
Purpose: This is a pop-up object which allows the user to initiate an action or to select an option using a "menu".

Description

For a Menu that is owned by a MenuBar or another Menu, the Caption property determines the text string that is displayed as the "choice". The Menu is then popped up by the user clicking on this text. It is automatically popped down when the user chooses an option (by selecting a MenuItem) or cancels the operation (by clicking elsewhere).

If a Menu belongs to a Form, SubForm or is a top-level object, it must be popped up by the application. This is commonly done in response to a MouseDown event. A Menu is popped-up by calling ⎕DQ with only the name of the Menu as its argument. The user may therefore not interact with any other object until a selection is made or until the operation is cancelled. When either occurs, the Menu is automatically popped down and de-activated, and its ⎕DQ terminates.

The Menu object does not have a Size property. Instead, its size is determined automatically by its contents.

If a Menu is owned by a MenuBar or by another Menu, its position within its parent is also calculated automatically, dependent on the order in which other related objects are established. The Posn property may however be used to insert a new Menu into an existing structure. For example, having defined three Menu objects as children of a MenuBar, you can insert a fourth one between the first and the second by specifying its Posn to be 2. Note that the value of Posn for the Menus that were previously second and third will then be reset to 3 and 4 respectively.

If a Menu is a child of a MenuBar which is itself a child of a Form or SubForm, the Align property can be set to 'Right'. This is used to position a single Menu (or MenuItem) at the rightmost end of a MenuBar. This does not apply if the MenuBar is owned by a ToolControl.

The BtnPix property is used to display a picture in a Menu. BtnPix specifies the names of, or refs to, three Bitmap objects. The first Bitmap is displayed when the Menu does not have the focus (normal), the second when it does have the focus (highlighted). The third Bitmap is displayed when the Menu is made inactive (Active property is 0). If Caption is also defined, it is displayed on top of the bitmaps.

If the Menu is a submenu (owned by a Menu), you may set its EdgeStyle property to 'Plinth'. This causes the Menu to take on an appearance that is similar to a pushbutton and be raised when not selected and recessed when selected. Note that to enable 3-dimensional appearance, you must set EdgeStyle to something other than 'None' for all the objects above the Menu in the tree.

EdgeStyle, BtnPix, Font, FCol and BCol do not affect the appearance of a Menu if it is the direct child of a MenuBar. However, the EdgeStyle property must be set to something other than 'None' if you want its children Menu and MenuItem objects to have a 3-dimensional appearance.